Home > Backend Development > PHP Tutorial > http - php 接收post请求时$_POST和$_REQUEST都为空?

http - php 接收post请求时$_POST和$_REQUEST都为空?

WBOY
Release: 2016-06-06 20:18:59
Original
1503 people have browsed it

下面是,http_header

http - php 接收post请求时$_POST和$_REQUEST都为空?


php 代码:

<code><?php echo var_dump($_POST);
echo '<br>'+ var_dump($_REQUEST) + '<br>' ;
?></code>
Copy after login
Copy after login
Copy after login

回复内容:

下面是,http_header

http - php 接收post请求时$_POST和$_REQUEST都为空?


php 代码:

<code><?php echo var_dump($_POST);
echo '<br>'+ var_dump($_REQUEST) + '<br>' ;
?></code>
Copy after login
Copy after login
Copy after login

<code><?php echo var_dump($_POST);
echo '<br>'+ var_dump($_REQUEST) + '<br>' ;
?></code>
Copy after login
Copy after login
Copy after login

以后调试像下面这样就可以了

<code><?php var_dump($_POST);
var_dump($_REQUEST) ;
?></code>
Copy after login

此外。PHP中的连字符用点号 . 不用加号+

试试 var_dump(file_get_contents('php://input'));

看 Response 有没有数据, 如果有, 说明 异步有处理, 需要在 ajax回调处理。。。如果没有,继续看看 ajax 地址是不是有问题

1.检查下form 表单 提交的路径是否正确
2.检查下表单元素的name 属性是否有值.

你用Ajax发送的时候,如果不用jQuery,那你得给你的form data编码。你可以参考jQuery.param

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