dump(
Db::table('destoon_ad')
->where('aid',1)
->find()
);
-----------------------------------------------------------
dump(
Db::table('destoon_ad')
->field(['title','image_url'])
->where([
'aid'=>['>',1],
'pid'=>['>',24],
])
->select()
);
-----------------------------------------------------------
闭包函数
$pid = 24;
dump(
Db::table('destoon_ad')
->field(['title','image_url'])
->where(function($query) use ($pid){
$query->where('aid','>',1)
->where('pid','>',$pid);
})
->select()
);
简写
$aid = 1;
dump(
Db::select(function($query) use ($aid){
$query->table('destoon_ad')
->field(['url'=>' 链接'])
->where([
'aid'=>['>',$aid],
'pid'=>['>',24]
]);
})
);