以前是这样写的
不过看了文档才知道只需要在
protected $model = null;
protected $relationSearch=true;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\ads\Ads;
$position=db('ads_position')->select();
$apps=db('apps')->where(['status'=>1])->select();
$this->assign('apps',$apps);
$this->assign('position',$position);
}
只需要添加一句就可以了
protected $relationSearch=true;