Recently, I am learning the relevant knowledge of PHP file operations. I will record one of the points to pay attention to in the readdir() function
1. In the $temp=readdir($handle) function, readdir obtains the file name and the file in $handle. Folder name,
Usually in the program, files are traversed through a while() loop:
while($temp=readdir($handel)){}
But there is a problem with the judgment statement of this way of writing: if there is a folder with a name of '0' under $handle, then $temp=0, the while loop cannot continue, then the remaining files cannot be traversed, resulting in incorrect program results,
The above has introduced the readdir function of PHP, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.