Home  >  Article  >  Backend Development  >  php怎么解析别人POST过来的body?

php怎么解析别人POST过来的body?

WBOY
WBOYOriginal
2016-06-23 13:24:191071browse

请问 如何解决C#post过来的数据 他说放在body里面  让我的接口调用 该如何实现拿到里面的数据 ? 求代码实例


回复讨论(解决方案)

file_put_contents('test.txt', print_r($_POST, 1));

看看文件内容

jsonp调用接口自然就收到了

求解还是不懂,连怎么测试都不知道……求测试代码

$post = file_get_contents("php://input");
var_dump($post);

<?php$data = $_POST;file_put_contents('data.txt', json_encode($data), true);?>


对方post后,看看data.txt有什么内容。

<?php$data = $_POST;file_put_contents('data.txt', json_encode($data), true);?>


对方post后,看看data.txt有什么内容。


大神 别人说把数据都放到body里面 比如把姓名 学号等信息以字符串的形式都放到body里面post给我 我不理解是什么意思 什么叫把数据放到body里面 怎么放  怎么实现接收这些数据 ?


<?php$data = $_POST;file_put_contents('data.txt', json_encode($data), true);?>


对方post后,看看data.txt有什么内容。


大神 别人说把数据都放到body里面 比如把姓名 学号等信息以字符串的形式都放到body里面post给我 我不理解是什么意思 什么叫把数据放到body里面 怎么放  怎么实现接收这些数据 ?

嗯。已经讲得很清楚了。
试试代码吧

放在body post就是在header把二进制post过来。
参考: http://blog.csdn.net/fdipzone/article/details/40098169

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