Currently I have the following code to read the contents of a directory. I have two questions that I would appreciate being answered.
Current Code:
Firstly, the script outputs something like the following:
My question, what does the . and the .. mean?
Secondly, I have some subfolders in that directory, how can I have the script read those too?
Thanks in advance.
Current Code:
| Code: |
| <html>
<head> <title>Directory test</title> </head> <body> <?php $dirname = "pictures/art/"; $dh = opendir( $dirname ) or die("couldn't open directory"); while ( $file = readdir( $dh ) ) { if ( is_dir( "$dirname/$file" ) ) print " "; print "$file<br>"; } closedir( $dh ); ?> </body> </html> |
Firstly, the script outputs something like the following:
| Quote: |
| .
.. a folder another folder file.ext HouseTop.JPG P1010783.JPG P1010785.JPG P1010786.JPG P1010788.JPG P1010789.JPG |
My question, what does the . and the .. mean?
Secondly, I have some subfolders in that directory, how can I have the script read those too?
Thanks in advance.
