PHP头条
热点:

php显示指定路径下的图片


代码如下:
function getAllDirAndFile($path)
{
if(is_file($path))
{
if(isImage($path))
{
$str="";
$str.='';
$str.="";
$path=iconv("gb2312","utf-8",$path);
$str.="";
$str.="";
$str.="
"https://www.php1.cn/detail/.$path."
";
echo $str;
}
}
else
{
$resource=opendir($path);
while ($file=readdir($resource))
{
if($file!="." && $file!="..")
{
getAllDirAndFile($path."/".$file);
}
}
}
}

function isImage($filePath)
{
$fileTypeArray=array("jpg","png","bmp","jpeg","gif","ico");
$filePath=strtolower($filePath);
$lastPosition=strrpos($filePath,".");
$isImage=false;
if($lastPosition>=0)
{
$fileType=substr($filePath,$lastPosition+1,strlen($filePath)-$lastPosition);
if(in_array($fileType,$fileTypeArray))
{
$isImage=true;
}
}
return $isImage;
}

www.phpzy.comtrue/php/9638.htmlTechArticlephp显示指定路径下的图片 代码如下: function getAllDirAndFile($path) { if(is_file($path)) { if(isImage($path)) { $str=""; $str.=' '; $str.=" "; $path=iconv("gb2312","utf-8",$path); $str.=" "https://www.php1.cn/detail/.$path." ";...

相关文章

相关频道:

PHP之友评论

今天推荐