url-一个php文件向另一个php文件传变量,$_POST取不到值

WBOY
Release: 2016-06-02 11:30:51
Original
1130 people have browsed it

phpurlxmlhttprequest

index.php里:
var request = new XMLHttpRequest();
request.open("POST","test.php");
request.setRequestHeader("Content-type","application/x-www-form-urlencoded");
var str="name="+url;
request.send(str);

text.php里:
$url=$_POST['name'];
echo $url;
两个文件在同一工程下,url是个变量,text.php执行会提示undefined index:name
readyState=4 Status=0 ,请问哪儿出错了

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