我试过下面的代码
<?php
foreach ($_wishlistitemCollection as $_wishlistitem):
$_product = $_wishlistitem->getProduct();
$imgpath = $this->helper('catalog/image')->init($_product, 'small_image');
$physpaths = array($imgpath);
endforeach;
?>
<?php
for ($i = 0; $i < 5; $i++) {
echo $physpaths[$i];
}
?>
没有错误,但问题是它没有显示 array 中的所有元素$physpaths
。
请帮助我如何确保$physpaths
包含所有元素或简单地指出我犯了错误的地方。