-1
我想在foreach循環中再添加一個數組。 下面是代碼:foreach中的兩個數組
$products = array();
$products = get_cat_images();
$name = array();
$name = get_cat_name();
foreach(array_chunk($products, 3) as $arr_images) {
echo "<div class = \"row\">";
foreach($arr_images as $detail_image) {
echo "
<div class=\"col-sm-4 col-md-4\">
<div class=\"service\"> <!-- Service #1 -->
<a href=\"service/civil-architecture.html\">
<img src=\"http://elektroteni.ru/".$detail_image."\" alt=\"\" class=\"img-responsive\">
</a>
<a href=\"service/civil-architecture.html\"><h4>".$name."</h4></a>
<p>description of the product</p>
<a class=\"read-more\" href=\"service/civil-architecture.html\">Read More <span class=\"fa fa-chevron-circle-right\"></span></a>
</div>
</div>
";
}
echo "</div>";
}
所以我想在循環正常顯示$name
陣列。 有幫助嗎?
告訴我們您的數組爲好。 – Noman
顯示此問題的表格。 –
該數組中的內容向我們展示了它的結構 –