PHP如何读取此对象数组

时间:2011-12-21 17:49:11

标签: php arrays

当我在php变量上执行print_r时,我得到了这个。 这是我正在处理的Web应用程序。

AMC Object
(
 [Player] => AMC_Player Object
    (
        [sourceObj:AMC_Player:private] => AMC Object
 *RECURSION*
        [videoList:AMC_Player:private] => Array
            (
                [0] => 33599
                [1] => 27922
                [3] => 33640
                [4] => 27919
                [5] => 33142
                [6] => 32343
                [7] => 33143
                [8] => 31437
                [9] => 27021
                [10] => 28157
                [11] => 29719
                [12] => 28142
                [13] => 18482
                [15] => 33794
                [16] => 33079
                [17] => 33799
                [18] => 28154
                [19] => 33104
                [20] => 28010
                [21] => 28398
            )

        [videoId:AMC_Player:private] => 
        [artistId:AMC_Player:private] => 
        [userId:AMC_Player:private] => 
        [userName:AMC_Player:private] => 
        [is_songpitches:AMC_Player:private] => 
    )

)

我正在尝试从videoList私有变量中获取值。

如何实现这一目标?

1 个答案:

答案 0 :(得分:1)

get

中有Player个函数
class Player{
    ...

    function getVideoList()
    {
        return $this->videoList;
    }
}

还有get

中的AMC函数
function getPlayVidList()
{
     return $this->AMC_Player->getVideoList();
}

$myVidList = $AMC->getPlayVidList();