我在打印数据时遇到问题。在我的程序中,我得到对象中的数据并放入一个数组中。说 array1[$id] = 数据对象。整个 array1 然后将被放入 array2['list'] 像 array2['list'] = array1;
问题是我如何获取 id、name 和 description 等数据。这是整个数组的 print_r:
这实际上是数组的结果,我不知道如何访问它。我想获取并获取名称并打印它们:
Array (
[list] => Array (
[0] => Array (
[0] => stdClass Object (
[id] => 1
[name] => harry potter 4
[description] => harry potter and the goblet of fire book by j.k. rowling
[unit_price] => 300.99
)
)
[1] => Array (
[0] => stdClass Object (
[id] => 4
[name] => lipton tea
[description] => yellow label tea
[unit_price] => 15.00
)
)
[2] => Array (
[0] => stdClass Object (
[id] => 9
[name] => tisyu
[description] => tissue twenty pieces
[unit_price] => 20.00
)
)
)
)