如何做多表關聯查詢

發表於2019-05-11
如何做多表關聯查詢 請大神附上資料模型與控制器程式碼
回覆
$keyword=I('get.keyword');
 $map['onethink_document_article.content'] = array('like','%'.$keyword.'%');
 $map['title'] = array('like','%'.$keyword.'%');
 $map['_logic'] = 'OR';

 $Model = M('Document') ;
 $list=$Model->join('JOIN onethink_document_article ON onethink_document_article.id = onethink_document.id')->page($p,20)->field('onethink_document.*')->where($map)->select();
 
評論

相關文章