Home > php教程 > php手册 > PHP在iframe 中session跨域丢失的解决办法

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 19:58:52
Original
1372 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");

 

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

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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template