PHP代码
public function hosiery(){
if (input('pid')) {//判断上一页传过来的pid
$brand = db('system_brand')->where(['id'=>input('pid'),'is_show'=>'true'])->find();
$shang = db('system_brand')->where(['id'=>input('pid')-1,'is_show'=>'true'])->find();
$xia = db('system_brand')->where(['id'=>input('pid')+1,'is_show'=>'true'])->find();
}else if (input('cid')) {//判断下一页传过来的cid
$brand = db('system_brand')->where(['id'=>input('cid'),'is_show'=>'true'])->find();
$shang = db('system_brand')->where(['id'=>input('cid')-1,'is_show'=>'true'])->find();
$xia = db('system_brand')->where(['id'=>input('cid')+1,'is_show'=>'true'])->find();
}else if (input('id')) {判断没有点击上下页
$brand = db('system_brand')->where(['id'=>input('id'),'is_show'=>'true'])->find();
$shang = db('system_brand')->where(['id'=>input('id')-1,'is_show'=>'true'])->find();
$xia = db('system_brand')->where(['id'=>input('id')+1,'is_show'=>'true'])->find();
}
$this->assign(['shang'=>$shang]);
$this->assign(['brand'=>$brand]);
$this->assign(['xia'=>$xia]);
return View();
}
html
实现效果如图
原创©本文章为陈敏原创,未经许可,禁止转载
0条评论