bjh Posted July 11, 2020 Share Posted July 11, 2020 I'm using the latest version of XAMPP on Windows and can't figure out why I'm not seeing the correct directory listing when using the scandir() function. The first time i opened the web page I got the correct listing of what was in the directory. After moving and adding files, I opened the web page again and got the same listing I had before i moved and added files. Is this the correct spot to ask this or should I use the XAMPP support forums? I tried $path= 'C:\\xampp\\htdocs\\website\\img\'; $listing = scandir($path); print_r($listing); I had 5 files in the 'img' directory the first time I opened the website and got the correct listings. I then added 10 new files and moved 2 files out and refreshed the page and got the same listings of the original 5 files. I closed and reopened the browser and tired again and got the original 5 files again. Quote Link to comment Share on other sites More sharing options...
NotSunfighter Posted July 11, 2020 Share Posted July 11, 2020 Shouldn't those double backwards slashes \\ be single \ ? Quote Link to comment Share on other sites More sharing options...
Barand Posted July 11, 2020 Share Posted July 11, 2020 No. \ is the escape character so needs to be \\ in a dir path. The final \ also needs to be \\ as it is currently escaping the quote at the end of the string. Easier is to use / in paths (even on windows) Quote Link to comment Share on other sites More sharing options...
gizmola Posted July 12, 2020 Share Posted July 12, 2020 5 hours ago, Barand said: No. \ is the escape character so needs to be \\ in a dir path. The final \ also needs to be \\ as it is currently escaping the quote at the end of the string. Easier is to use / in paths (even on windows) Yes, or the DIRECTORY_SEPARATOR constant, which is equivalent to '/' Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.