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']]);
原文地址:https://www.cnblogs.com/wen-zi/p/9023908.html