1
<?php

$path = "/home/qeplaho/public_html/image/";
$dir_handle = @opendir($path) or die("Unable to open folder");
echo "<table>";
echo"<tr>";
while (false !== ($file = readdir($dir_handle))) {

if($file != '.' && $file != '..' && $file){
//echo "<td><input type=CHECKBOX name=$file></td>";
echo "<td><img width='200' height='200' src='/home/qeplaho/public_html/image/'  ><br>
      $file
  </td>";
  //$file
  //alt='$file'
}
}
echo"<tr/>";
echo"</table>";
closedir($dir_handle);

?>

这是我的代码,我想显示此目录“图像”中的所有图像,但图像未正确显示并分解我能做什么?pplz 帮助我作为 php 中的新手,并为我提供与此相关的简单解决方案

4

1 回答 1

1

你可能需要更换这个

echo "<td><img width='200' height='200' src='/home/qeplaho/public_html/image/'  ><br>
      $file
</td>";

有了这个

echo "<td><img width='200' height='200' src='/image/$file'/></td>";
于 2013-07-06T10:41:20.930 回答