在PHP中,可以使用var_dump()或print_r()函数来打印JSON数组内部的数组值。
$jsonData = '{"name":"John","age":30,"hobbies":["reading","painting","cooking"]}';
$arrayData = json_decode($jsonData, true);
var_dump($arrayData['hobbies']);
输出结果为:
array(3) {
[0]=>
string(7) "reading"
[1]=>
string(8) "painting"
[2]=>
string(7) "cooking"
}
$jsonData = '{"name":"John","age":30,"hobbies":["reading","painting","cooking"]}';
$arrayData = json_decode($jsonData, true);
print_r($arrayData['hobbies']);
输出结果为:
Array
(
[0] => reading
[1] => painting
[2] => cooking
)
以上是在PHP中打印JSON数组内部的数组值的方法。如果你需要详细了解PHP的相关知识,可以参考腾讯云的PHP开发者指南(https://cloud.tencent.com/document/product/234/467)和PHP文档(https://www.php.net/manual/)了解更多信息。
领取专属 10元无门槛券
手把手带您无忧上云