Who will help me see what this function means? PHPcodefunctiondelFileUnderDir ($ dirName) {if ($ handleopendir (& quot; $ dirName & quot;) {while (false! ($ Itemreaddir ($ handle) {if anyone can help me see what this function means
PHP code
Function delFileUnderDir ($ dirName) {if ($ handle = opendir ("$ dirName") {while (false! ==( $ Item = readdir ($ handle) {// if ($ item! = "." & $ Item! = ".. ") {If (is_dir (" $ dirName/$ item ") {delFileUnderDir (" $ dirName/$ item ");} else {if (unlink ("$ dirName/$ item") echo "successfully deleted the file: $ dirName/$ item
\ N ";}} closedir ($ handle );}}
False! = ($ Item = readdir ($ handle) what does it mean and call a recursive function? I don't really understand it !!
------ Solution --------------------
Delete a file in a folder.
If readdir () is successful, the file name is returned, or FALSE is returned if a failure occurs.
Failure means that opendir () has an error. the directory does not exist or cannot be read.
False! ==( $ Item = readdir ($ handle ))
That is to say, if the file information in the directory is successfully read.
In fact, the glob () function makes this function easier to use.
------ Solution --------------------
Opendir, readdir, standard unix c interface.
This function recursively deletes all common files in a directory and subdirectory.