Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在PHP中读取GET和POST请求(POST在json中)_Php_Post_Get - Fatal编程技术网

如何在PHP中读取GET和POST请求(POST在json中)

如何在PHP中读取GET和POST请求(POST在json中),php,post,get,Php,Post,Get,我有一个javascript不是从我这里来的,用于在客户端javascript和服务器php之间同步信息,并将javascript发送到服务器GET和POST信息,我可以读取easy GET信息,因此我尝试读取$\u POST信息,但无法检索POST信息 我尝试打印\u r$\u POST,但返回的数组中没有任何内容 我试着用Firebug和控制台来查看Firefox,我看到了这一点 如何检索json字符串并将其转换为>Transmission de la requete

我有一个javascript不是从我这里来的,用于在客户端javascript和服务器php之间同步信息,并将javascript发送到服务器GET和POST信息,我可以读取easy GET信息,因此我尝试读取$\u POST信息,但无法检索POST信息

我尝试打印\u r$\u POST,但返回的数组中没有任何内容

我试着用Firebug和控制台来查看Firefox,我看到了这一点

如何检索json字符串并将其转换为>Transmission de la requete<并转换为PHP代码?我可以很容易地检索GET参数,比如token、src等,所以我无法检索传输后的参数


谢谢你的帮助

我真的不明白你的意思。但因为它类似于发送到页面的JSON请求。您可以使用文件“获取内容”php://input'以获取发送的任何JSON请求。然后您可以将其解码为对象或数组

范例

$request = file_get_contents('php://input');
获取对象

因此,输入字段将是

$input->name; $input->password;
$input[name]; $input[password];
获取数组

因此,输入字段将是

$input->name; $input->password;
$input[name]; $input[password];

请求是通过post jsonI发送的吗?我想是的,所以我不确定,我在GET参数下看到,json字符串包含channel、ext、fm.meta profileID等,我尝试从requestTank读取这些信息,您是这行:$request=file\u GET\u contents'php://input'; 可以给我访问json字符串!谢谢大家!!!!