This article is suitable for beginners of the small white PHP directory operation functions related to understanding.
<?php/** Directory-related Operations function we know that article has a.txt b.txt c.txt d.txt We can write, but when the file has e.html F.mp3 .... We simply process TXT file using glob () matching file ****///print_r (glob (' *.txt ')); Glob () is looking for a matching//print_r (Glob ('./article/*.txt ') in the current directory); OK//glob () is useful at work, but the focus today is not//To view all files in the directory, open the directory with Opendir/* Opendir, return the resource handle, available for subsequent closedir (), Readdir (), and Rewinddir ()
In the call. Readdir read directory \, success returns a filename or returns FALSE on failure, so I use NULL to mkdir create directory rmdir delete directory Closedir close directory Is_dir to determine if it is a directory Unlin
K Delete file */$path = './misc '; Var_dump (Opendir ($path));
Resource (3, stream) $dh = Opendir ($path); /* echo Readdir ($DH);
// . echo Readdir ($DH);
// .. echo Readdir ($DH); A.txt Echo Readdir ($DH); B.exe//. And..
is the virtual directory, the current directory and superior directory, * * echo "