PHP如何回显JSON对象
我曾多次尝试使用explode函数回显JSON对象,但没有成功。我想我用了一种错误的方法,但我找不到另一种方法 我想回显JSON,如:PHP如何回显JSON对象,php,json,printing,echo,explode,Php,Json,Printing,Echo,Explode,我曾多次尝试使用explode函数回显JSON对象,但没有成功。我想我用了一种错误的方法,但我找不到另一种方法 我想回显JSON,如: { "Title_Book": "Harry Potter", "Volume": [ { "Name": "Harry Potter and the Philosopher's Stone", "Actor": [ {
{
"Title_Book": "Harry Potter",
"Volume": [
{
"Name": "Harry Potter and the Philosopher's Stone",
"Actor": [
{
"Actor": "Actor0"
},
{
"Actor": "Actor1"
}
]
},
{
"Name": "Harry Potter and the Chamber of Secrets",
"Actor": [
{
"Actor": "Actor0"
}
]
}
]
},
{
"Title_Book" : Another Book
...
}
作为:
将第二个参数设置为true时使用
示例代码:
$booksArray = json_decode($libraryJsonString,true);
foreach ($booksArray as $books) {
print_r($books);
}
而不是打印数组;您可以放置另一个foreach循环来迭代数组的每个元素。要查看阵列解码后的外观,请使用:
$booksArray = json_decode($libraryJsonString,true);
print_r($booksArray);
看起来您必须删除卷阵列上的键。我说得对吗?
$booksArray = json_decode($libraryJsonString,true);
print_r($booksArray);