php 上一条下一条,thinkPhp里添加显示上一条和下一条
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                php 上一条下一条,thinkPhp里添加显示上一条和下一条
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.                        
                                newsinfo.php里的代碼
if($front['id']!=null){
$id??=?$front['id'];
echo?"上一條:$front[title]";
}else{
echo?"上一條:沒有了";
}
echo?"????";
if($after['id']!=null){
echo?"下一條:$after[title]";
}else{
echo?"下一條:沒有了";
}
?>
========
action里的代碼
public?function?newsinfo(){
$this->info?=?M('info')->where("cid=18?and?id="?.?$_GET['id'])->find();
$this->front=M('info')->where("cid=18?and?idorder('id?desc')->limit('1')->find();
$this->after=M('info')->where("cid=18?and?id>".$_GET['id'])->order('id?desc')->limit('1')->find();
$this->display();
}
沒有想象中的難么難得!
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的php 上一条下一条,thinkPhp里添加显示上一条和下一条的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: nacos 本地测试_Nacos注册中心
- 下一篇: matlab库存点仿真教程,基于MATL
