Home > php教程 > php手册 > body text

PHP在iframe 中session跨域丢失的解决办法

WBOY
Release: 2016-06-06 19:58:52
Original
1271 people have browsed it

最近做项目过程中遇到了一个问题那就是 PHP在iframe 中session跨域丢失,查了半天最后终于搞定了,方法如下?: 在页面A中我们写了session_start() 同时iframe到页面B中, 这时候我们的页面B怎么来获取A中定义的SESSION 变量呢,我们只要在页面B中header 一

最近做项目过程中遇到了一个问题那就是

PHP在iframe 中session跨域丢失,查了半天最后终于搞定了,方法如下?:

在页面A中我们写了session_start() 同时iframe到页面B中,

这时候我们的页面B怎么来获取A中定义的SESSION 变量呢,我们只要在页面B中header 一下就行了 如代码:

 

session_start();
 
header("P3P: CP=CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR");

 

试试吧。。反正我是成功了!

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!