这样可以显示出一张图片 但是我想把img文件夹下所有的图片都显示出来应该怎么呢?我改成这样不行$url = 'upload/'; 那么应该怎么办呢?
<code>header("Content-Type: image/jpeg;text/html; charset=utf-8");
$url='1.jpg';
$img = file_get_contents($url,true);
echo $img;</code>这样可以显示出一张图片 但是我想把img文件夹下所有的图片都显示出来应该怎么呢?我改成这样不行$url = 'upload/'; 那么应该怎么办呢?
<code>header("Content-Type: image/jpeg;text/html; charset=utf-8");
$url='1.jpg';
$img = file_get_contents($url,true);
echo $img;</code>
方法很多,事例如下
<code>$dir = "upload/"; //要获取的目录
if (is_dir($dir)){
if ($dh = opendir($dir)){
while (($file = readdir($dh))!= false){
$filePath = $dir.$file;
echo "@@##@@";
}
closedir($dh);
}
}</code>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号