The query method of tp6.0 is based on the data set object. You cannot directly use empty to judge, but you must use the isEmpty method of the data set object to judge.

It should be noted that if you want to judge whether the data set is empty, you cannot use emptythe judgment directly, but must use the method of the data set object isEmptyto judge, for example:

$users = Db::name('user')->select();
if($users->isEmpty()){
    echo '数据集为空';
}

Guess you like

Origin blog.csdn.net/qq_34861341/article/details/126548183