<php
!defined('FRAMEWORK_PATH') && exit('Accesss Deined');
class user_control extends base_control {
public function on_index(){
// 方法 2
$user_list = DB::T('user')->select([
'id' => ['>', 1],
'id_' => ['<=', 100],
], 'id DESC', -1);
// 方法 2 需要建立 user extends base_model
$user_list = $this->user->select([
'id' => ['>', 1],
'id_' => ['<=', 100],
], 'id DESC', -1);
// 案例,查 id>1 and id<=100 and id<>5 的用户
$user_list = $this->user->select([
'id' => ['>', 1],
'id_' => ['<>', 5],
'id__' => ['<=', 100],
], 'id DESC', -1);
}
}
在 mzphp 中,以_结尾的字段都会并列入查询条件,无论多少个 (下划线) 都会过滤掉,所以字段名不能以下划线结尾哦~