所以我将一个 PHP stdClass() 对象传递给 Smarty,它看起来像这样,例如:
stdClass Object
(
[1] => stdClass Object
(
[id] => 1
[children] => stdClass Object
(
[4123] => stdClass Object
(
[id] => 4123
[children] => stdClass Object
(
[221] => stdClass Object
(
[id] => 221
[children] => stdClass Object
(
)
),
[55] => stdClass Object
(
[id] => 55
[children] => stdClass Object
(
)
)
)
),
[666] => stdClass Object
(
[id] => 666
[children] => stdClass Object
(
)
)
)
)
)
每个对象都有一个 id 和 children,它们具有相同的结构。我怎样才能像这样递归地输出所有 id-s:1, 4123, 221, 55, 666
使用 Smarty ?