<?php
/**
* copyright (c) crossphp.cn
* author aray
* created 2009-07-25
*
**/
$exts = array(
'.x',
'.html',
'.dwt',
'.lbi',
'.htm',
'.php',
'.js',
'.css',
'.xml',
'.txt',
);
$start = false;
if ($_POST && !empty($_POST['path']) )
{
$start = true;
$PATH = $_POST['path'];
$PATH = addslashes($PATH);
$EXTS = $_POST['exts'];
}
function ReadDirs($path, $ext)
{
global $BOM;
$dir = opendir($path );
echo '<ul>';
while ( ($file = readdir($dir )))
{
if ($file == '.' || $file == '..') continue;
$f = $path . '/' . $file;
if (is_dir($f))
{
echo '<li class="folder"><span class="symbol">1</span>' . $file;
echo '<ul>' . ReadDirs($f, $ext) . '</ul></li>';
}
else
{
$flag = false;
if ( is_array($ext) )
{
if (! in_array(getExt($file), $ext) )
{
continue;
}
else
{
$flag = true;
}
}
else
{
$flag = true;
}
if ($flag)
{
$cssClass = 'file';
if (checkBOM($f))
{
$cssClass = 'bom';
$BOM[] = str_replace('//','/',str_replace('\\','/',$f));
}
echo '<li class="'.$cssClass.'"><span class="symbol">2</span>' . $file . $isBom . "</li>";
}
}
}
echo '</ul>';
}
function getExt($filename )
{
$ext = strrchr($filename,'.');
// 根本没有扩展名
if ( empty($ext) )
{
return null;
}
return $ext;
}
function checkBOM($filename )
{
$contents = file_get_contents($filename);
$char[1] = substr($contents, 0, 1); // 1
$char[2] = substr($contents, 1, 1); // 2
$char[3] = substr($contents, 2, 1); // 3
// EF BB BF
if ( ord($char[1]) == 239 && ord($char[2]) == 187 && ord($char[3]) == 191 )
{
return true;
}
return false;
}
?>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>BOM检测工具</title><style type="text/css">body,td,th { font-size: 14px;}body { margin-left: 15%; margin-top: 2px; margin-right: 15%; margin-bottom: 2px;}form { margin: 0px; padding: 0px;}ul { margin: 0px 0px 0px auto; padding: 0px;}.symbol { font-family: Wingdings; font-size: 20px; padding-right: 10px;}.path { color:#0033CC;}li { color: #333333; list-style: none;}.bom { color: #ff00ff;}.folder { color: #0000ff;}.file { color: #333333;}</style></head><body><br/><br/><table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#8DAFDA"><tr><td height="70" align="center" valign="middle" bgcolor="#CBDBEE"><form id="form1" name="form1" method="post" action=""><table border="0" cellspacing="0" cellpadding="0"><tr>
<td height="30" align="left" valign="middle">文件夹:</td><td align="left" valign="middle"><select name="path" ><?php $dir = opendir('.'); while ( ($f = readdir($dir)) ){ if ($f == '..' || is_file('./' . $f) ) continue; ?><option value=".\<?=$f?>" <?php if($_POST['path'] == '.\\'.$f) echo 'selected';?> ><?=$f?></option><?php }?></select></td><td align="left" valign="middle"><input type="submit" name="button" id="button" value="提交" /></td></tr></table><?php foreach($exts as $ext){ ?><label><input type="checkbox" name="exts[]" value="<?=$ext?>" <?php if(is_array($_POST['exts']) && in_array($ext, $_POST['exts'])) echo 'checked'; ?> /><?=$ext?></label><?php }?></form></td></tr></table><div id="result"><br/><br/><?php if($start){?><?php echo '搜索路径: <span class="path">' . str_replace('\\\\','\\',$PATH) . '</span> , 实际路径: <span class="path">' . realpath($PATH) . '</span><br/>'; echo '文件列表: '; ReadDirs( $PATH, $EXTS);?><br/><br/><?php if ($BOM) { ?>发现BOM文件列表:<br/><ul><?php foreach( $BOM as $f){?><li class="bom"><?=$f?></li><?php }?></ul><?php }?><?php }?></div></body></html>
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。【项目质量】:所有源码都经过严格测试,可以直接运行。功能在确认正常工作后才上传。【适用人群】:适用于希望学习不同技术领域的小白或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。【附加价值】:项目具有较高的学习借鉴价值,也可直接拿来修改复刻。对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。【沟通交流】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。鼓励下载和使用,并欢迎大家互相学习,共同进步。
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![py](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 1 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/d28ac9b54fe948548c78a7d8383e66a3_qq_34910341.jpg!1)
CrMylive.
- 粉丝: 8753
- 资源: 4万+
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- 打包和分发Rust工具.pdf
- SQL中的CREATE LOGFILE GROUP 语句.pdf
- C语言-leetcode题解之第172题阶乘后的零.zip
- C语言-leetcode题解之第171题Excel列表序号.zip
- C语言-leetcode题解之第169题多数元素.zip
- ocr-图像识别资源ocr-图像识别资源
- 图像识别:基于Resnet50 + VGG16模型融合的人体细胞癌症分类模型实现-图像识别资源
- C语言-leetcode题解之第168题Excel列表名称.zip
- C语言-leetcode题解之第167题两数之和II-输入有序数组.zip
- C语言-leetcode题解之第166题分数到小数.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)