分页显示当前页数
//商品列表
public function goods_list()
{
if(Request::instance()->param("page"))
{
$page=Request::instance()->param("page");
}else{
$page=1;
}
$count=Db::table("goods")->count();
$tiao=3;
$zong_page=ceil($count/$tiao);
$limit=($page-1)*$tiao;
/*$arr=Db::query("SELECT g.goods_id,g.goods_name,g.goods_sn,g.goods_price,g.sort,p.product_id,p.sku from goods as g left join
product as p ON g.goods_id = p.goods_id group by goods_id limit $limit,$tiao");*/
$arr=Db::table("goods")
->alias('g')
->field('g.goods_id,g.goods_name,g.goods_sn,g.goods_price,g.sort,p.product_id,p.sku')
->join('product p','g.goods_id = p.goods_id')
->group('goods_id')
->limit($limit,$tiao)
->select();
//var_dump($arr);die;
$show['shou_page']=1;//首页
$show['shang_page']=$page-1<1?1:$page-1;//上一页
$show['xia_page']=$page+1>$zong_page?$zong_page:$page+1;//下一页
$show['wei_page']=$zong_page;//尾页
$show['zong_page']=$zong_page;//总页
$show['count']=$count;//总条数
$show['p']=$page;//当前页数
$data=['arr'=>$arr,'show'=>$show];
// var_dump($arr);die;
return view("goods_list",['data'=>$data]);
}
你所浪费的今天是那些死去的人所奢望的明天,你所厌恶的现在是未来的你所回不去的曾经。