php file search (file search)

不言
Release: 2023-03-25 17:24:01
Original
2385 people have browsed it

   php版文件查找(file search) 

文件查找(注:区分大小写)

路径:

查找:

"; $file_num = $dir_num = 0; $r_file_num = $r_dir_num= 0; $findFile = $_POST['key']; function delDirAndFile( $dirName ){ if ( $handle = @opendir( "$dirName" ) ) { while ( false !== ( $item = readdir( $handle ) ) ) { if ( $item != "." && $item != ".." ) { if ( is_dir( "$dirName/$item" ) ) { delDirAndFile( "$dirName/$item" ); } else { $GLOBALS['file_num']++; if(strstr($item,$GLOBALS['findFile'])){ echo " $dirName/$item
\n"; $GLOBALS['r_file_num']++; } } } } closedir( $handle ); $GLOBALS['dir_num']++; if(strstr($dirName,$GLOBALS['findFile'])){ $loop = explode($GLOBALS['findFile'],$dirName); $countArr = count($loop)-1; if(empty($loop[$countArr])){ echo " $dirName
\n"; $GLOBALS['r_dir_num']++; } } }else{ die("没有此路径!"); } } delDirAndFile($_POST['path']); echo "
本次共搜索到".$file_num."个文件,文件夹".$dir_num."个
"; echo "
符合结果的共".$r_file_num."个文件,文件夹".$r_dir_num."个
"; } ?>
Copy after login

The above is the entire content of this article. For more related content, please pay attention to the PHP Chinese website.

Related recommendations:

php file compression package

php file upload and the basic use of uploadifive

The above is the detailed content of php file search (file search). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!