thinkphp js跨域问题和session

WBOY
Release: 2016-06-06 20:38:13
Original
1157 people have browsed it

用的框架是ThinkPHP
我用ajax发送给后台一个信息,(出现跨域错误,于是,我就加上header('Access-Control-Allow-Origin: *');),需要验证session 但是我发现var_export($_SESSION); 是空的

问题:1、在http://localhost/deno/index.php/Home/Index/personal.html 发送到http://127.0.0.1/deno/index.php/Home/item/delete.html 就在一个项目里面,为什么会出现跨域问题
2、怎么解决获取session数据的问题?

回复内容:

用的框架是ThinkPHP
我用ajax发送给后台一个信息,(出现跨域错误,于是,我就加上header('Access-Control-Allow-Origin: *');),需要验证session 但是我发现var_export($_SESSION); 是空的

问题:1、在http://localhost/deno/index.php/Home/Index/personal.html 发送到http://127.0.0.1/deno/index.php/Home/item/delete.html 就在一个项目里面,为什么会出现跨域问题
2、怎么解决获取session数据的问题?

127.0.0.1换成localhost就可以了

怎么解决跨域发送sessionid的问题?

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!