版本: v2.3.0
has
检查数据表中是否存在匹配记录。
has($table, $where)
table [string]
要查询的数据表名称。
where [array]
用于检查匹配记录的 WHERE 条件。
has($table, $join, $where)
table [string]
要查询的数据表名称。
join [array]
用于关联相关数据表的 JOIN 定义;如果不需要 JOIN,可省略此参数。
where [array]
用于检查匹配记录的 WHERE 条件。
返回值
[bool] 如果至少存在一条匹配记录,则返回
true;否则返回 false。$isAccount = $database->has("account", [
"AND" => [
"OR" => [
"user_name" => "foo",
"email" => "foo"
],
"password" => "12345"
]
]);
if ($isAccount) {
echo "密码正确。";
} else {
echo "密码无效。";
}