clearstatcache - Third time lucky... (PHP question)

Posted by thomase, 09-11-2008, 02:21 PM
I've asked two people who are pretty good at PHP and no luck so far. I've got this bit of code which needs to check if a file exists before echoing the file. Now, according to php.net file_exists caches on the server so you've got to use clearstatcache everytime to remove this cache to check again. I've tried it without the varible in, with it in, above the thing, below, etc, and still have had no luck getting it to work! The url is correct too...and a file exists but it still doesn't echo anything. Any help is appreciated

Posted by Adam-AEC, 09-11-2008, 02:34 PM
Single quotes escape variables! Remove them when you are just specifying the variable between the quotes, and use double quotes in the variable assignment. And you shouldn't have to worry about clearing the cache unless you are checking the existence of that file twice in one request.

Posted by thomase, 09-11-2008, 02:55 PM
That's not worked. The image path is still correct when I echo it, but it's not finding the file (with or without the clearstatscache)

Posted by Adam-AEC, 09-11-2008, 03:48 PM
There are still single quotes around the variable where you call file_exists. So, it's looking for a file _actually_ called $filename. You don't want that. It should be: file_exists($filename)

Posted by thomase, 09-11-2008, 04:34 PM
Thank you very much That's works! Last edited by sirius; 09-11-2008 at 04:38 PM.

Hai trovato questa risposta utile?

 Stampa Articolo

Leggi anche

please Recommendation ( spam protect )

Posted by endin, 06-26-2008, 08:30 AMHi, please Recommendation to manage my server please...

Database server in different continent?

Posted by UberTricep, 10-27-2012, 08:23 AMHello, Is it wise to have a web server hosted in...

looking for creditcard processing international

Posted by zhai, 09-05-2001, 07:36 PMi'm nearly decide to use service from revecom.com but after...

Disallow a site from sending out emails

Posted by HappyPike, 05-04-2007, 12:51 AMHi, Is there a way to disallow a certain site from...

Question about Server Load?

Posted by olddocks, 01-10-2008, 07:09 PMi run about 3 sites all on a shared server with bluehost....