1

所以目前我有一个正在运行的脚本

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

将以下数据返回给 $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
        )

)

我正在尝试获得以下值

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

现在我尝试使用将其转换为数组

$arr= (array) $obj;

然后简单地通过指定来获取值

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

但它不起作用,我应该如何检索值?

4

1 回答 1

1

关于什么:

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

只要_aConditions是对象中的公共数组,这应该可以工作。

于 2013-08-05T19:20:25.603 回答