版本: 1.1.3
get
从表中仅获取一条记录
get($table, $columns, $where)
table [string]
表名称。
columns [string/array]
将获取数据的目标字段列表。
where (optional) [array]
过滤记录的 WHERE 子句。
返回: [string/array] 返回这些字段的数据。
此方法仅获取一条记录。
$email = $database->get("account", "email", [
"user_id" => 1234
]);
// $email = "[email protected]"
$profile = $database->get("account", [
"email",
"gender",
"location"
], [
"user_id" => 1234
]);
// $profile = array(
// "email" => "[email protected]",
// "gender" => "female",
// "location" => "earth"
// )
