如何解析 JSON 并访问结果
本文介绍了如何解析 JSON 并访问结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I am using CURL to send a request. The response dataType is json
. How can I parse this data and insert it into the database?
JSON Output:
解决方案
If your $result
variable is a string json like, you must use json_decode
function to parse it as an object or array:
OUTPUT
Now you can work with $json
variable as an array:
References:
- json_decode - PHP Manual
这篇关于如何解析 JSON 并访问结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!