phpjson转数组
时间: 2023-08-24 22:11:19 浏览: 101
JSON 转 数组方法
在PHP中,可以使用json_decode()函数将JSON字符串转换为数组。例如,如果有一个JSON字符串 $json = '{"title":"标题","url":"meitu.jpg"}';,可以使用以下代码将其转换为数组:
$json = '{"title":"标题","url":"meitu.jpg"}';
$array_json = json_decode($json, true);
print_r($array_json);
输出结果将是:
Array ( \[title\] => 标题 \[url\] => meitu.jpg ) \[1\]
#### 引用[.reference_title]
- *1* *3* [PHP数组与JSON互相转换](https://blog.csdn.net/qq_39339179/article/details/128830421)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [php json转数组的例子](https://blog.csdn.net/weixin_39612817/article/details/115880698)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文