在PHP中读取从android发送的JSON对象
当PHP应用程序中的JSON对象由android应用程序发送时,我可以读取该对象吗? 我不知道我是否被允许在easy php中使用json_decode(), 下面是将json对象从android发送到php应用程序的代码 试一试{ Log.i(“--------------”,“\uuuuuuuuuuuu4\uuuuuuuuu” 下面是在php中读取json对象的代码在PHP中读取从android发送的JSON对象,php,android,json,Php,Android,Json,当PHP应用程序中的JSON对象由android应用程序发送时,我可以读取该对象吗? 我不知道我是否被允许在easy php中使用json_decode(), 下面是将json对象从android发送到php应用程序的代码 试一试{ Log.i(“--------------”,“\uuuuuuuuuuuu4\uuuuuuuuu” 下面是在php中读取json对象的代码 $decoded = json_decode($_GET['json'], true); //$decoded = j
$decoded = json_decode($_GET['json'], true);
//$decoded = json_decode($_POST['json']);
// do something with data here
$Longitude = $decoded['action'];
$Lattetude = $decoded['User'];
$l= $decoded['Password'];
$la = $decoded['IMEI'];
但是当执行时,我得到了这个错误
Error parsing data org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
解析数据org.json.JSONException:Value时出错
httppost.setHeader("json", json.toString());
它设置了一个标题,而不是一个POST参数。在PHP中,您希望执行以下操作:
$decoded = json_decode($_SERVER['HTTP_JSON'], true);
$decoded = json_decode($_SERVER['HTTP_JSON'], true);