我在使用 php 循环 json 对象时遇到了奇怪的问题。这是我的数据格式
stdClass Object
(
[userform] => Array
(
[0] => stdClass Object
(
[id] => 69
[product] => testuser
)
[1] => stdClass Object
(
[id] => 70
[product] => testuser
)
[2] => stdClass Object
(
[id] => 71
[product] => testuser
)
[3] => stdClass Object
(
[id] => 72
[product] => testuser
)
[4] => stdClass Object
(
[id] => 73
[product] => testuser
)
[5] => stdClass Object
(
[id] => 74
[product] => testuser
)
[6] => stdClass Object
(
[id] => 75
[product] => testuser
)
[7] => stdClass Object
(
[id] => 76
[product] => testuser
)
[8] => stdClass Object
(
[id] => 77
[product] => testuser
)
[9] => stdClass Object
(
[id] => 78
[product] => testuser
)
[10] => stdClass Object
(
[id] => 79
[product] => testuser
)
[11] => stdClass Object
(
[id] => 80
[product] => testuser
)
[12] => stdClass Object
(
[id] => 81
[product] => testuser
)
[13] => stdClass Object
(
[id] => 82
[product] => testuser
)
[14] => stdClass Object
(
[id] => 83
[product] => testuser
)
[15] => stdClass Object
(
[id] => 84
[product] => testuser
)
[16] => stdClass Object
(
[id] => 85
[product] => testuser
)
[17] => stdClass Object
(
[id] => 86
[product] => testuser
)
[18] => stdClass Object
(
[id] => 87
[product] => testuser
)
[19] => stdClass Object
(
[id] => 88
[product] => testuser
)
[20] => stdClass Object
(
[id] => 89
[product] => testuser
)
)
)
但是这个循环会引发以下错误。
试图获取非对象的属性
请让我知道如何 从上述格式中读取产品属性值
谢谢大家