Home > Backend Development > PHP Tutorial > 请问用thinkphp写的代码session的有关问题

请问用thinkphp写的代码session的有关问题

WBOY
Release: 2016-06-13 12:13:16
Original
981 people have browsed it

请教用thinkphp写的代码session的问题
代码是这样的

  public function index(){
$name=cookie('name');

$mess=getuserlink();

$id=$_GET['id'];

session('addressid',$id);
cookie("goodsid",$id,3600000);

dump(session('addressid'));
dump(cookie('goodsid'));

其实就是把id参数保存到session里以备其他页面使用,并且已经用dump确认过了是正确的
结果如下
string(32) "88d2a7d29f90075584073212a2883ab8"
string(32) "88d2a7d29f90075584073212a2883ab8"

但是换了一个页面,就变了

 public function index(){

$name=cookie('name');

$mess=getuserlink();

if (is_null($name) ){
$name=fy('游客');
}

dump(session("addressid"));

echo("=======cookie");
echo(cookie("goodsid"));
echo("=======cookie");
显示的结果是
string(71) "templatesquare&count=1&callback=jQuery1640937174090417102_1420208544222"
=======cookie
templatesquare&count=1&callback=jQuery1640937174090417102_1420208544222=======cookie

请问有人知道怎么回事吗?
------解决思路----------------------
string(71) "templatesquare&count=1&callback=jQuery1640937174090417102_1420208544222"
=======cookie
                  templatesquare&count=1&callback=jQuery1640937174090417102_1420208544222=======cookie

请问下,你两个不是一样?
------解决思路----------------------
string(71) "templatesquare&count=1&callback=jQuery1640937174090417102_1420208544222"
=======cookie
templatesquare&count=1&callback=jQuery1640937174090417102_1420208544222=======cookie

一样的。
------解决思路----------------------
不是你弄的,你怎么能看的到?
那是 jquery jsonp 请求时的 url 参数

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template