Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
213 views
in Technique[技术] by (71.8m points)

php - how to retrieve variable from object

I want to retrieve $se_module value from my object. How can I get that? I can easily get others by $object->Owner->name. I've tried $object->{$se_module}, but got error as undefined variable.

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

Quote is needed )

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

you cane make it as array then you can get it

$data = (array)$se_module;

then can get data like this

$data['Modified_Time'];


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...