Heim  >  Artikel  >  Backend-Entwicklung  >  php 显示指定路径下的图片_PHP教程

php 显示指定路径下的图片_PHP教程

WBOY
WBOYOriginal
2016-07-21 15:43:291102Durchsuche

复制代码 代码如下:

function getAllDirAndFile($path)
{
if(is_file($path))
{
if(isImage($path))
{
$str="";
$str.='';
$str.="";
$path=iconv("gb2312","utf-8",$path);
$str.="";
$str.="";
$str.="
".$path." php 显示指定路径下的图片_PHP教程
";
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.bkjia.comtruehttp://www.bkjia.com/PHPjc/320734.htmlTechArticle复制代码 代码如下: function getAllDirAndFile($path) { if(is_file($path)) { if(isImage($path)) { $str=""; $str.='table style="border:solid 1px blue;" width="95%"'; $str.="tr...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn