访问数组元素

时间:2013-07-16 05:54:49

标签: php arrays vimeo

帮我从下面的代码中访问[_content]。

    stdClass Object
(
    [generated_in] => 0.0265
    [stat] => ok
    [thumbnails] => stdClass Object
        (
            [thumbnail] => Array
                (
                    [0] => stdClass Object
                        (
                            [height] => 75
                            [width] => 100
                            [_content] => http://b.vimeocdn.com/ts/436/245/436245278_100.jpg
                        )

                    [1] => stdClass Object
                        (
                            [height] => 150
                            [width] => 200
                            [_content] => http://b.vimeocdn.com/ts/436/245/436245278_200.jpg
                        )

                    [2] => stdClass Object
                        (
                            [height] => 360
                            [width] => 640
                            [_content] => http://b.vimeocdn.com/ts/436/245/436245278_640.jpg
                        )

                )

        )

)

2 个答案:

答案 0 :(得分:3)

尝试

foreach($myarr->thumbnails->thumbnail as $arr) {
   echo $arr->_content."<br>";
}

假设$myarr是你的数组。

答案 1 :(得分:0)

用于内部数组

<?php  for( $i= 0 ; $i< count( $this->thumbnails->thumbnail); $i++ ){ 
        $temp = $this->thumbnails->thumbnail[$i]['_content'] ; ?>