php解码JSON数据为数组或对象
作者:xlnxin发布时间:2025-05-06分类:编程知识浏览:444
导读:$jsonString = '{"name":"John Doe","age":3...
$jsonString = '{"name":"John Doe","age":30,"city":"New York"}';
$decodedData = json_decode($jsonString, true);
echo $decodedData['name']; // 输出: John Doe如果将第二个参数设置为false(默认值),则返回一个对象:
$decodedData = json_decode($jsonString); echo $decodedData->name; // 输出: John Doe
- 编程知识排行
- 最近发表

