クロージャ内でページングをクエリする場合、SQL を出力するためのページング条件は付加されず、デフォルトではすべて表示されます。
年年年年年
年年年年年 2019-03-06 11:43:58
0
5
1322

なぜ教師が直接記述して使用できるのでしょうか? テストしたところ、すべてが表示されました。ページング条件は直接無視されました。SQL を印刷すると、ページング条件がないことが表示されました。

年年年年年
年年年年年

全員に返信(4)
尾生

そのコードの位置を変更するだけです:

public functionindex()
{
//カテゴリ情報表示
$cateId=Request::param('cate_id');

を使用する 使用する を使用する を使用する を使用するthrough using through through through through through through through through through over over over through over over''''-'''''-'- ‐ であると考えられる

isset($cateId)){
$res=ArtCate::get($cateId);
$this->view->assign('cateName',$res->name);
$artList=Db ::name('zh_article')
(3);
$this->view-> ;assign('artList',$artList);
}
else{
$artList=Db::name('zh_article' )
- ->where('status ', 1) &-& gt; Order (' Create_time ',' Desc ')-& GT; assign (' cateneme ',' すべての記事');
}
$this->view->assign('artList',$artList);

$this->fetch();
}

いいねを押す +0
尾生

抱歉,应该是这样的:

if (isset($cateId))
{
$artList=Db::table('zh_article')
->where('status',1)
->where ('cate_id',$cateId)
->order('create_time','desc')->paginate(3);



}
$artList=Db::table('zh_article')
- >where('status',1)
->where('cate_id',$cateId)
->order('create_time','desc')->paginate(3);


$this ->view->assign('artList',$artList);

return $this->fetch();


いいねを押す +0
尾生

if (isset($cateId))
{
$artList=Db::table('zh_article')
->where('status',1)
->where('cate_id',$cateId)
->order('create_time','desc')->paginate(3);



}
$artList=Db::table('zh_article')
->where('status',1 )

->order('create_time','desc')->paginate(3);


$this->view->assign('artList',$artList);

return $ this->fetch();

この子は出来ます

いいねを押す +0
永~不~低~头

同じ質問

いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!