Home  >  Article  >  Backend Development  >  php跨域能取得客户端COOKIES吗,写了几句话都倒处报错,实在是受不了了。

php跨域能取得客户端COOKIES吗,写了几句话都倒处报错,实在是受不了了。

WBOY
WBOYOriginal
2016-06-13 12:32:29736browse

在线等php跨域能取得客户端COOKIES吗,写了几句话都倒处报错,实在是受不了了。求助!
做了一个测试的例子,结果到处是错,而且偶根本看不出来哪里有错,求助。
http://www.test1.com/test.htm
nbsp;HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">





<script></script>



http://www.test2.com/下面有两个文件

test.js
document.write("<script></script>");

test.php
//print_r($_COOKIE);
echo "<script>alert('test');</script>";
?> 

直接输入http://www.test2.com/test.php没有错误
但是输入http://www.test1.com/test.htm报语错误。

一来是想测试下
setcookie("TestCookie",$value);
$_COOKIE["TestCookie"];
结果直接不能运行,求助,实在逼得没有办法了。谢谢大家!
Statement:
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