简体   繁体   English

从对象PHP检索值

[英]Retrieve value from object PHP

so currently I have a script where running 所以目前我有一个脚本在哪里运行

$obj = $this->search()->browse()->params($aBrowseParams);

returns the following data to $obj 将以下数据返回到$ obj

Phpfox_Search_Browse Object
(
    [_iCnt:Phpfox_Search_Browse:private] => 2


    [_aParams:Phpfox_Search_Browse:private] => Array
        (
            [module_id] => music.song
            [alias] => m
            [field] => song_id
            [table] => phpfox_music_song
            [hide_view] => Array
                (
                    [0] => pending
                    [1] => my
                )

            [service] => music.song.browse
        )

    [_oBrowse:Phpfox_Search_Browse:private] => Music_Service_Song_Browse Object
        (
            [_sTable:protected] => 
        )

    [_sView:Phpfox_Search_Browse:private] => 
    [_aConditions] => Array
        (
            [0] => AND ( (m.title LIKE '%test%') )
            [1] => AND m.view_id = 0 AND m.privacy IN(0)
            [2] => AND m.item_id = 0
        )

)

I'm attempting to get the following value 我正在尝试获得以下价值

AND ( (m.title LIKE '%test%') )

Now I've tried converting it to an array using 现在我尝试使用将其转换为数组

$arr= (array) $obj;

then simply getting the value by specifying 然后只需通过指定获取值

$obj['value']['value'] 

but it's not working, how should I retrieve the value? 但它不起作用,我应该如何检索该值?

What about: 关于什么:

$value = $obj->_aConditions[0];

This should work as long as _aConditions is a public array in the object. 只要_aConditions是对象中的公共数组, _aConditions应该起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM