我正在尝试制作一个php脚本,它可以监听来自这个java类的http请求,我尝试使用$_POST,但似乎不起作用。任何帮助都将不胜感激!
尝试echo file_get_contents("php://input");
,了解java类到底发送了什么。只有当数据是url编码的字符串时,$_POST
才会工作。如果您的javaclass正在发送json,您应该这样阅读:$JSON = json_decode(file_get_contents("php://input"), true);
我正在尝试制作一个php脚本,它可以监听来自这个java类的http请求,我尝试使用$_POST,但似乎不起作用。任何帮助都将不胜感激!
尝试echo file_get_contents("php://input");
,了解java类到底发送了什么。只有当数据是url编码的字符串时,$_POST
才会工作。如果您的javaclass正在发送json,您应该这样阅读:$JSON = json_decode(file_get_contents("php://input"), true);