上边的形式该怎么循环,新手求救。。。。
------解决方案--------------------
$arr = array(
'https://www.gxlcms.com/images/small_case_1.jpg',
'https://www.gxlcms.com/images/small_case_2.jpg',
'https://www.gxlcms.com/images/small_case_3.jpg',
'https://www.gxlcms.com/images/small_case_4.jpg',
'https://www.gxlcms.com/images/small_case_5.jpg',
'https://www.gxlcms.com/images/small_case_6.jpg',
'https://www.gxlcms.com/images/small_case_7.jpg',
'https://www.gxlcms.com/images/small_case_8.jpg',
'https://www.gxlcms.com/images/small_case_9.jpg'
);
function arr2li($arr){
$html = '';
if(is_array($arr) && !empty($arr)){
$count = count($arr);
for($i=0; $i<$count; $i++){
$rem = $i%3;
$html .= ($i!=0 && $rem==0) ? "\n\r\n\r" : "";
$html .= ($rem==0) ? "
- \n\r" : "";
$html .= sprintf("
$html .= ($i+1==$count) ? "
}
}
return $html;
}
/*
*/
echo arr2li($arr);
------解决方案--------------------
$result=mysql_query("select * from case_list");
while($row=mysql_fetch_assoc($result)){
$ar[]=$row;
}
foreach(array_chunk($ar,3) as $v){
echo "- \n";
foreach($v as $vl) echo "
echo "
}








