我有这样的脚本:PHP图片显示
<?php
$count = 0;
foreach(glob("images/{*.gif,*.jpg,*.png,*.jpeg,*.bmp}", GLOB_BRACE) as $image)
while ($image)
{
if($count==3)
{
print "</tr>";
$count = 0;
}
if($count==0)
print "<tr>";
print "<td>";
?>
<img src="<?php echo $image;?>" width="80" height="80"/>
<?php
$count++;
print "</td>";
}
if($count>0)
print "</tr>";
?>
它应该拍摄的图像从一个文件夹(“图片”在这种情况下),并在一排显示他们3。但它显示一个图片1000000次。我该如何解决这个问题?我试图解决这个问题,我只知道问题在于“while”行。
我觉得你并不需要'而($图像)' – fedorqui 2013-02-25 15:51:23