时间:2021-07-01 10:21:17 帮助过:2人阅读
混乱指的是?
没明白什么意思。。。。。
每次b把cookie打印出来看看有问题嘛
//地区登陆进口
$region = m('region');
$get_region = $region->get_list($parent_id='482');
$this->assign('get_region', $get_region);
//print_r($get_region);
empty($_COOKIE['city_id']) ? $region_id = '477' : $region_id = $_COOKIE['city_id'];
if($_SERVER['REQUEST_METHOD'] == 'GET') {
if(!empty($_REQUEST['RegionId'])) {
setcookie('city_id','',time()-3600);
$region_id = intval($_REQUEST['RegionId']);
}
}
setcookie('city_id',$region_id,time()+3600*24*30*12);
echo $_COOKIE['city_id'];
打印cookie发现值对不起来
问题解决了,是点击的时候cookie值还是上一次的值,做一次header跳转就行了