Get
从表中仅获取一条记录。
get($table, $columns, $where)
-
table [string]
表名。
-
columns [string/array]
将要获取的目标列数据。
-
where (可选) [array]
用于过滤记录的 WHERE 子句。
get($table, $join, $columns, $where)
-
table [string]
表名。
-
join [array]
表的表关联。如果不需要表连接,请忽略它。
-
columns [string/array]
将要获取的目标列数据。
-
where (可选) [array]
用于过滤记录的 WHERE 子句。
返回: [string/array/int/object] 返回列的数据。
$email = $database->get("account", "email", [ "user_id" => 1234 ]); // $email = "foo@bar.com" $profile = $database->get("account", [ "email", "gender", "location" ], [ "user_id" => 1234 ]); // $profile = array( // "email" => "foo@bar.com", // "gender" => "female", // "location" => "earth" // ) $data = $database->get("post", [ "[>]account" => "user_id" ], [ "post.content", "account.user_name", "account.location" ], [ "ORDER" => "post.rate" ]); // $data = array( // "content" => "A new day", // "user_name" => "foo", // "location" => "earth" // )