标签:blog io ar sp on div log cti as
public function index(){ $cate = 1; $query = M(‘Cate‘)->field(‘id‘)->where(array(‘id‘=>$cate,‘pid‘=>$cate,‘_logic‘=>‘OR‘))->buildSql();//在一个表中获得栏目的id $goods = M(‘Goods‘)->where(‘cate_id in ‘ . $query)->select(); //在另一个表获得属于这些栏目的文章 p($goods); //$this->display(); }
[ThinkPHP] 从一个表中获得栏目对应的ID,从另一个表获得属于这些栏目的文章
标签:blog io ar sp on div log cti as
原文地址:http://www.cnblogs.com/bushe/p/4121301.html