php 显示指定路径下的图片
发布时间:2020-12-13 05:36:27 所属栏目:PHP教程 来源:网络整理
导读:div class="codetitle" a style="CURSOR: pointer" data="42472" class="copybut" id="copybut42472" onclick="doCopy('code42472')" 代码如下: div class="codebody" id="code42472" function getAllDirAndFile($path) { if(is_file($path)) { if(isImage($
<div class="codetitle"><a style="CURSOR: pointer" data="42472" class="copybut" id="copybut42472" onclick="doCopy('code42472')"> 代码如下:<div class="codebody" id="code42472"> | ".$path."</td> | $str.="</tr>"; $str.="</table>"; 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; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |