且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从对象数组中获取数据

更新时间:2023-11-30 22:45:58

从输出中可以看到,对象成员可能是私有的(如果遵循约定,无论如何,在调用它们时都必须在其前面加上下划线),因此你打错电话给他们; 这段代码有效:

As you can see by your output, object members are likely to be private (if you follow conventions, anyway you must prepend an underscore while calling them), so you're calling them the wrong way; This code works:

$this->_data->fields['province'][0];

您可以在此处看到它. 我创建了一个类似的对象,并使用

You can see it in action here; I created a similar object, and using

$membership = new RSMembershipModelSubscribe();
echo $membership->_data->fields['province'][0];

按预期输出"Flevoland".

outputs "Flevoland" as expected.