本文介绍了如何JSON字符串转换为数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要做的是以下内容:
What I want to do is the following:
- 以JSON作为输入从文本区在PHP
- 使用该输入,并将其转换成JSON并把它传递到PHP卷曲发送请求。
这米API获取得到在PHP中,这JSON字符串我想传递给JSON,但它不转换成数组
this m getting at php from get of api this json string i want to pass to json but it is not converting to array
echo $str='{
action : "create",
record: {
type: "n$product",
fields: {
n$name: "Bread",
n$price: 2.11
},
namespaces: { "my.demo": "n" }
}
}';
$json = json_decode($str, true);
以上code未返回我的数组。
the above code is not returning me array.
推荐答案
你的意思是功能 json_de code()
?你可以阅读更多关于它在这里:
Do you mean the function json_decode()
? You can read more about it here:
<一个href=\"http://www.php.net/manual/en/function.json-de$c$c.php\">http://www.php.net/manual/en/function.json-de$c$c.php
这篇关于如何JSON字符串转换为数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!