0
我知道如何執行正常的foreach循環,但似乎無法爲vafpress框架返回的數組使用它。我正在使用var_dump(vp_metabox('vp_meta_sample_2.binding_group'));它正在生成下面提到的數組。我怎樣才能遍歷所有的圖像!通過vafpress返回的數組循環遍歷
(1) { [0]=> array(4) { ["name"]=> string(1) "1" ["url"]=> string(10) "234234.com" ["image"]=> string(62) "http://localhost/wp/wp-content/uploads/2014/02/bottomright.jpg" ["shortcode"]=> string(108) "[shortcode name="1" url="234234.com" image="http://localhost/wp/wp-content/uploads/2014/02/bottomright.jpg"]" } }
我用下面的循環得到的值
$age=print_r (vp_metabox('vp_meta_sample_2.binding_group'));
print_r ($age);
foreach($age as $x=>$x_value)
{
echo "Key=" . $x . ", Value=" . $x_value;
echo "<br>";
}
確定我刪除print_r的,但你能告訴我如何循環這個輸出數組( 1){[0] => array(4){[「name」] => string(1)「1」[「url」] => string(10)「234234.com」[「image」] =>字符串(62)「http:// localhost/w 「[shortcode」] => string(108)「[shortcode name =」1「url =」234234.com「image =」http:// localhost /wp/wp-content/uploads/2014/02/bottomright.jpg「]」}} – user2976690
看看[這個鏈接](http://stackoverflow.com/questions/10057671/how-foreach-actually-works) –