Directory processing function

The basic idea of processing folders is as follows:

1. When reading a certain path, determine whether it is a folder

2. If it is a folder, open the specified folder and return Resource variables of the file directory

3. Use readdir to read the files in the directory once, and the directory pointer is shifted backward once

4. Use readdir to read to the end, and there is no readable file Return false

5. Close the file directory

Let’s learn a list of common functions:


QQ截图20161009111919.png##

'; echo readdir($dh).'
'; echo readdir($dh).'
'; echo readdir($dh).'
'; //读取到最后返回false //关闭文件夹资源 closedir($dh); } } ?> 即然是读取一次向后移动一次,我们是不是可以 "; } closedir($dh); } } ?>


Continuing Learning
||
'; echo readdir($dh).'
'; echo readdir($dh).'
'; echo readdir($dh).'
'; //读取到最后返回false //关闭文件夹资源 closedir($dh); } } ?> 即然是读取一次向后移动一次,我们是不是可以 "; } closedir($dh); } } ?>
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!