想从数组中获取值

时间:2014-10-17 13:40:09

标签: php

我想在filename中获得meta_data array的值。我希望得到以下值:thumbs_M_73c0e89c3b5b44c030f727649980f5e0.jpg。我尝试了以下代码,但没有得到值。

不起作用:

foreach ($gallery as $image) {             
  foreach ($image->meta_data['thumbnail'] as $image) {         
      print_r($image);
  }

这是我的阵列

Array (
    [43] => nggImage Object (
        [_ngiw] => C_Image_Wrapper Object (
            [_cache] => Array (
                [alttext] => M_73c0e89c3b5b44c030f727649980f5e0
                [author] => 1
                [description] => 
                [errmsg] => 
                [error] => 
                [exclude] => 0
                [extras_post_id] => 20589
                [filename] => M_73c0e89c3b5b44c030f727649980f5e0.jpg
                [galdesc] => 
                [galleryid] => 1
                [gid] => 1
                [hidden] => 
                [href] => 
                [imagePath] => 
                [imageURL] => 
                [image_slug] => m_73c0e89c3b5b44c030f727649980f5e0
                [imagedate] => 2014-03-21 10:58:00
                [meta_data] => Array (
                    [width] => 800
                    [height] => 1200
                    [full] => Array (
                        [width] => 800
                        [height] => 1200
                    )

                    [thumbnail] => Array (
                        [width] => 240
                        [height] => 340
                        [filename] => thumbs_M_73c0e89c3b5b44c030f727649980f5e0.jpg
                        [generated] => 0.19071200 1413550789
                    )

                    [aperture] => F 4.5
                    [credit] => 
                    [camera] => Canon EOS 5D Mark III
                    [caption] => 
                    [created_timestamp] => March 21, 2014 10:58 am
                    [copyright] => 
                    [focal_length] => 85 mm
                    [iso] => 100
                    [shutter_speed] => 1/200 sec
                    [flash] => Fired
                    [title] => 
                    [keywords] => 
                    [saved] => 1
                    [ngg0dyn-200x200x90-00f0w010c010r110f110r010t03jpg] => Array (
                        [width] => 133
                        [height] => 200
                        [filename] => M_73c0e89c3b5b44c030f727649980f5e0-nggid0243-ngg0dyn-200x200x90-00f0w010c010r110f110r010t03jpg.jpg
                        [generated] => 0.32975900 1413551556
                    )   
                )

0 个答案:

没有答案