insertByForeach.php alias('a') -join('__USER__ ac', 'a.openid = ac.openid', "left") -field('a.*,ac.*,a.id as idd') -order('a.time', 'desc') -select(); foreach($list as $key=$v){ $cwhere['a.payid'] = $list[$key]['id']; $comment = Db::name('l
alias('a') ->join('__USER__ ac', 'a.openid = ac.openid', "left") ->field('a.*,ac.*,a.id as idd') ->order('a.time', 'desc') ->select(); foreach($list as $key=>$v){ $cwhere['a.payid'] = $list[$key]['id']; $comment = Db::name('lun')->alias('a')->join('__USER__ ac', 'a.openid = ac.openid', "left")->field('a.*,ac.*')->where($cwhere)->order('time desc')->select(); $list[$key]['comment'] = $comment; }