Copy CodeThe code is as follows:
function Getalldirandfile ($path)
{
if (Is_file ($path))
{
if (Isimage ($path))
{
$str = "";
$str. = '
'; $str. = "
"; $path =iconv ("gb2312", "Utf-8", $path); $str. = "
". $path." |
| "; $str. = "
"; $str. = "
";
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;
}
The above describes the display driver has stopped responding and has successfully restored the PHP display under the specified path of the picture, including the display driver has stopped responding and has been successful recovery of the content, I hope to be interested in PHP tutorial friends helpful.