Heim  >  Artikel  >  Backend-Entwicklung  >  ajax传值到php页面,存入session。在其他页面调用不到存入的session值

ajax传值到php页面,存入session。在其他页面调用不到存入的session值

WBOY
WBOYOriginal
2016-06-06 20:38:561225Durchsuche

有人遇到过这样的现象吗,利用ajax去请求到a.php页面,然后在a.php页面用session存储ajax传过来的值,然后在b.php页面调用session中的值,但是空的

回复内容:

有人遇到过这样的现象吗,利用ajax去请求到a.php页面,然后在a.php页面用session存储ajax传过来的值,然后在b.php页面调用session中的值,但是空的

1、确认下session id 一致
2、确认下session_start开启,并且之前没有任何输出。

看看ajax的header是否带了session_id,没带说明cookie丢失或者跨域了。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn