我正在研究如何在不将其更改为数组的情况下访问对象,如其他答案所示。例如,我有一个像下面这样的对象,我想访问_attributes
数组。
我是对象的新手,请原谅我。
User Object
(
[_profile:protected] =>
[created_at] => 2015-03-25 05:09:16
[created_by] =>
[updated_at] => 2015-03-25 05:09:16
[updated_by] =>
[_new:CActiveRecord:private] =>
[_attributes:CActiveRecord:private] => Array
(
[id] => 1
[guid] => 09da4555-f61e-4cab-a552-f3ef3d0e23f8
[wall_id] => 1
[group_id] => 1
[status] => 1
[super_admin] => 1
答案 0 :(得分:0)
我弄明白了,我必须访问$var->attributes->id
或$var->displayName
等对象。