如何从对象中检索变量

时间:2019-01-10 08:37:52

标签: php

我想从我的对象中检索$ se_module值。我该怎么办?我可以通过$ object-> Owner-> name轻松获得其他人。我试过$ object-> {$ se_module},但未定义变量出错。

stdClass Object ( [Owner] => stdClass Object ( [name] => Merv Henry [id] => 2880896000003943001 )

[Modified_Time] => 2019-01-09T21:25:05-05:00
[$attachments] => 
[Created_Time] => 2019-01-09T21:25:05-05:00
[Parent_Id] => stdClass Object
    (
        [name] => 
        [id] => 2880896000011553097
    )

[$editable] => 1
[$se_module] => Deals
[Modified_By] => stdClass Object
    (
        [name] => Merv Henry
        [id] => 2880896000003943001
    )

[$size] => 
[$voice_note] => 
[id] => 2880896000011676081
[Created_By] => stdClass Object
    (
        [name] => Merv Henry
        [id] => 2880896000003943001
    )

[Note_Title] => 
[Note_Content] => This unit needs 1@ DA97-12540K & 1@ DA97-13718C

[Modified_Time] => 2019-01-09T21:25:05-05:00 [$attachments] => [Created_Time] => 2019-01-09T21:25:05-05:00 [Parent_Id] => stdClass Object ( [name] => [id] => 2880896000011553097 ) [$editable] => 1 [$se_module] => Deals [Modified_By] => stdClass Object ( [name] => Merv Henry [id] => 2880896000003943001 ) [$size] => [$voice_note] => [id] => 2880896000011676081 [Created_By] => stdClass Object ( [name] => Merv Henry [id] => 2880896000003943001 ) [Note_Title] => [Note_Content] => This unit needs 1@ DA97-12540K & 1@ DA97-13718C

1 个答案:

答案 0 :(得分:0)

您可以将其制成数组,然后可以获取

$data = (array)$se_module;

然后可以获取这样的数据

$data['Modified_Time'];