public function index()
{
//模型实列化调用get()和find()方法
$ad = new Destoon_ad;
$where = function($query){
$query->field(['pid','url'])->where('aid',1);
};
$result = $ad->find($where); //get()方法
dump($result->getData());
}
public function index()
{
//模型实列化调用select()方法
$ad = new Destoon_ad;
$where = function($query){
$query->field(['pid','url'])->where('aid','>',1);
};
$result = $ad->select($where);
foreach ($result as $value){
dump($value->getData());
}
}
静态方法
public function index()
{
//模型静态find()和get()方法
$where = function($query){
$query->where(['aid'=>1]);
};
$result = Destoon_ad::get($where);
dump($result->getData());
}