我有这个脚本很好用,但我需要添加一个命令来搜索所有子文件夹。示例:我有一个文件夹 data 并且它包含更多其他文件夹......我需要在这个文件夹中搜索文件。$dir = 'data'; $exclude = array('.', '..', '.htaccess'); $q = (isset($_GET['q'])) ? strtolower($_GET['q']) : ''; $res = opendir($dir); while(false !== ($file = readdir($res))) { if(strpos(strtolower($file), $q) !== false &&!in_array($file, $exclude)) { echo "<a href='$dir/$file'>$file</a>"; echo "<br>"; } } closedir($res);
- 2 回答
- 0 关注
- 115 浏览
添加回答
举报
0/150
提交
取消