我有這個腳本很好用,但我需要添加一個命令來搜索所有子文件夾。示例:我有一個文件夾 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 關注
- 127 瀏覽
添加回答
舉報
0/150
提交
取消