Home >Backend Development >PHP Tutorial >为何PHP不能接收。

为何PHP不能接收。

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:45:451005browse

为什么PHP不能接收。。

 $.ajax({<br />       type: "POST",<br />        url: "index.php",<br />        data: "location=img_png_src",<br />        success: function(msg){<br />         alert( "Data Saved: " + msg );<br />           }<br />      });<br />

<?php echo $_POST["location"]; ?>


PHP接受不了 报错了 Notice: Undefined index: location in C:\wamp\www\makebanner\index.php on line 45
------解决方案--------------------
<?php<br />if($_SERVER['REQUEST_METHOD'] == "POST") {<br />  print_r($_POST);<br />  exit();<br />}<br />?><br /><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script><br /><script><br />$(function() {<br /> $.ajax({<br />       type: "POST",<br />//        url: "index.php",<br />        data: "location=img_png_src",<br />        success: function(msg){<br />         alert( "Data Saved: " + msg );<br />           }<br />      });<br />});<br /></script><br />

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