0

以下のデータ構造から「期間」を という変数に抽出するのに助けが必要ですvar_dur

データは次のものから取得されます。print_r($data);

Guzzle\Service\Resource\Model Object
(
    [structure:protected] => 
    [data:protected] => Array
        (
            [Job] => Array
                (
                    [Arn] => arn:aws:elastictranscoder:us-west-2:98yufdos8u:job/fsdoiufds98u
                    [Id] => fdsu98sdufio
                    [Input] => Array
                        (
                            [AspectRatio] => auto
                            [Container] => auto
                            [FrameRate] => auto
                            [Interlaced] => auto
                            [Key] => iudyf98udsf
                            [Resolution] => auto
                        )

                    [Output] => Array
                        (
                            [AlbumArt] => 
                            [Composition] => 
                            [Duration] => 31
                            [Height] => 522
                            [Id] => 1
                            [Key] => dlsjf9ds8uf9d8sjuf9s.mp4
                            [PresetId] => sdufhy89dsfu98dsf
                            [Rotate] => 0
                            [SegmentDuration] => 
                            [Status] => Complete
                            [StatusDetail] => 
                            [ThumbnailPattern] => filename-700thumb-{resolution}-{count}
                            [Watermarks] => Array
                                (
                                )

                            [Width] => 640
                        )

                    [OutputKeyPrefix] => 
                    [Outputs] => Array
                        (
                            [0] => Array
                                (
                                    [AlbumArt] => 
                                    [Composition] => 
                                    [Duration] => 31
                                    [Height] => 522
                                    [Id] => 1
                                    [Key] => dlsjf9ds8uf9d8sjuf9s.mp4
                                    [PresetId] => duisfy98dsuf89sd
                                    [Rotate] => 0
                                    [SegmentDuration] => 
                                    [Status] => Complete
                                    [StatusDetail] => 
                                    [ThumbnailPattern] => filename-700thumb-{resolution}-{count}
                                    [Watermarks] => Array
                                        (
                                        )

                                    [Width] => 640
                                )

                        )

                    [PipelineId] => dsuf89dsuf89d
                    [Playlists] => Array
                        (
                        )

                    [Status] => Complete
                )

        )

)
4

2 に答える 2

0

配列を反復処理するには、このようなことを行います

function searchfor($text, $array) {
  foreach (array_expression as $key => $val)
    if($key == $text){
       return $val
    }

    if(is_array($var){
     return searchfor($text, $var);
    }
  }

  return null;
}
于 2014-05-22T09:10:09.230 に答える