tp5关联模型进行条件查询

 

public function wordOne(){
        return $this->hasOne('TeachWord','id','w_id')->field('id,pid,title');
    }

 

 

查询:以pid为条件查询

$sql = new TeachNews();
        $sql= $sql->hasWhere('wordOne',['pid'=>$search['wordList']]);

 

posted @ 2018-05-11 12:34  狼人杀  阅读(1066)  评论(0)    收藏  举报