PHP 对象文本
2022-08-30 09:00:34
在PHP中,我可以很容易地指定数组文本:
array(
array("name" => "John", "hobby" => "hiking"),
array("name" => "Jane", "hobby" => "dancing"),
...
)
但是,如果我想要对象数组呢?如何在PHP中指定对象文本?即在javascript中,它将是:
[
{name: "John", hobby: "hiking"},
{name: "Jane", hobby: "dancing"}
]