开发者

PHP correct while-loop: (false !== ($file = readdir($handle))) is not showing recent files changes with MAMP on OSX

开发者 https://www.devze.com 2023-03-22 13:55 出处:网络
By now I\'m convinced that I must be one of the few who experienced something like this. The problem is that my PHP is not listing updates (or recent file changes) in a certain directory.

By now I'm convinced that I must be one of the few who experienced something like this. The problem is that my PHP is not listing updates (or recent file changes) in a certain directory.

Say I have 3 files: 1.jpg 2.jpg 3.jpg

When I do something like this:

while (false !== ($file = readdir($handle))) {
    echo $file.'<br />';
}

I get:

.

..

1.jpg

2.jpg

3.jpg

Which is expected, but the problem is that when I remove one file I still see the old list of three files. I have checked with Apache by navigating directly to the directory and I do see the new change with just two files in the folder. If I output the image in HTML I get three image-tags but the last one is empty. So no caching going on there with Apache.

I am using MAMP on OSX, I have disabled everything I can think of, so no XCache, no eAccelerator, and also no-cache in the header. I've even tried with clearstatcache() followed by restarting the server / computer, changing from 开发者_运维百科PHP 5.3 to PHP 5.2 then back again.

Last two things I tried, upgraded MAMP to latest version (currently 2.0.1) and cleared all .DS_Store from my localhost but to no avail. I see the updates in Finder, Apache sees them as well, its just PHP that decides to stick to the old version of the folder's contents.

My PHP version is 5.3 with MAMP on OSX Snow Leopard.

Any ideas / suggestions are more than welcome :)

0

精彩评论

暂无评论...
验证码 换一张
取 消