2014-02-28 86 views
1

低於獲取數組值

Array ( 
    [0] => Array (
     [re_text_field_id] => No posts to display 
     [re_textarea_field_id] => boring jokes 
     [re_image_field_id] => Array (
      [id] => 6 
      [src] => http://localhost/project/wp-content/uploads/2014/02/bg1.gif 
     ) 
    ) [1] => Array (
     [re_text_field_id] => fuck it 
     [re_textarea_field_id] => I feel dumb for asking, but how on earth would i go about using the repeatable fields in a way which outputs the fields needed 
     [re_image_field_id] => Array (
      [id] => 4 [src] => http://localhost/project/wp-content/uploads/2014/02/bg-gradient1.png 
     ) 
    ) 
) 

我調試輸出要獲得文本字段我用

$options = get_option('demo_options') 
$slides = $options['re_']; 
foreach ($slides as $slide) { 
echo $slide['re_textarea_field_id']; 
} 

但我無法得到圖像路徑有點像這樣

echo $slide['re_image _field_id']; 

回答

1

嘗試這是爲了回顧圖像的路徑。需要添加['src']

echo $slide['re_image_field_id']['src']; 
+0

非常感謝你 –