Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/228.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
如何从android解码PHP密码中的JSON字符串?_Php_Android_Json - Fatal编程技术网

如何从android解码PHP密码中的JSON字符串?

如何从android解码PHP密码中的JSON字符串?,php,android,json,Php,Android,Json,我想在Php中解码来自android的json字符串 假设我有以下来自android的json {“name”:“ajay”} 在php中,我是这样做的 <?php $result=json_decode('$_POST',true); $name=$result['name']; $response=array(); $response["message"]=$name successfully parse in php; echo json_encode($response); ?&g

我想在Php中解码来自android的json字符串

假设我有以下来自android的json
{“name”:“ajay”} 在php中,我是这样做的

<?php
$result=json_decode('$_POST',true);
$name=$result['name'];
$response=array();
$response["message"]=$name successfully parse in php;
echo json_encode($response);
?>


这会给出html标记作为响应。有什么办法解决这个问题吗?

这对我来说似乎很好

<?php
  $result=json_decode('{"name":"ajay"} ',true);
  $name=$result['name'];
  $response=array();
  $response["message"]="$name successfully parse in php";
  echo json_encode($response);
?>

这对我来说似乎很管用

<?php
  $result=json_decode('{"name":"ajay"} ',true);
  $name=$result['name'];
  $response=array();
  $response["message"]="$name successfully parse in php";
  echo json_encode($response);
?>

点击此链接。也许这会有帮助:


点击此链接。也许这会有帮助:


和?你的问题是什么?你必须得到正确的$u POST字段,在快速搜索之后,请查看以下链接:和?你的问题是什么?你必须得到正确的$u POST字段在快速搜索之后查看以下链接:这会给出html标记作为响应你粘贴代码并运行它。我在上面代码的输出中没有得到任何html标记。它将给您
{“message”:“ajay成功地在php中解析”}
作为输出。可能是您正在修改输出。如果是这样,请发布您正在尝试的代码。我正在将json字符串从android传递到Php。但我无法在Php中获取json字符串。请帮助meThis给出html标记作为响应。您粘贴代码并运行它。我在上面代码的输出中没有得到任何html标记。它将给您
{“message”:“ajay成功地在php中解析”}
作为输出。可能是您正在修改输出。如果是这样,请发布您正在尝试的代码。我正在将json字符串从android传递到Php。但我无法在Php中获取json字符串。请您帮我描述一下。。不要只发布一个链接作为答案。你必须解释答案。或者在answerLink中添加注释。只有答案才是答案,因为如果链接消失,信息可能会丢失。你能稍微描述一下吗。。不要只发布一个链接作为答案。你必须解释答案。或者在answerLink中添加注释,因为如果链接消失,信息可能会丢失,因此仅答案不是答案。