简体   繁体   中英

PHP How do I read this Object Array

When I do a print_r on a php variable I get this. This is for a web application i'm working on.

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] => 
    )

)

I'm attemping to get the values out of the videoList private variable.

How can this be accomplished?

Have a get function in the Player class

class Player{
    ...

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

And also a get function in the AMC class

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

$myVidList = $AMC->getPlayVidList();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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