php check what files are in the directory

angryTom
Release: 2023-02-27 22:58:01
Original
2082 people have browsed it

php check what files are in the directory

php Check what files are in the directory

php Check what files are in the directory You can use opendir to open the path, and then use Just read the content and output it with readdir.

"; //先判断指定的路径是不是一个文件夹 if (is_dir($dir)){ if ($dh = opendir($dir)){ while (($file = readdir($dh))!= false){ //文件名的全路径 包含文件名 $filePath = $dir.$file; //获取文件修改时间 $fmt = filemtime($filePath); echo "(".date("Y-m-d H:i:s",$fmt).") ".$filePath."
"; } closedir($dh); } } ?>
Copy after login

Effect:

php check what files are in the directory

For more PHP related knowledge, please visitPHP Chinese website!

The above is the detailed content of php check what files are in the directory. 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!