PHP find if file in different top folder exists
What i want to do is find if a file in a different top folder exists.
Lets开发者_如何学Go say I want to access the file this "page".html
, I would have to access it like:
file_exists('../data/pages/this "page".html')
But that wont work, it just returns false. Any suggestions?
i am making a flat file cms, so filenames can have quotes. url: http://ffcms.comxa.com/admin user: tann98 pass: pswd
Thanks in advance.
Try this
file_exists('../data/pages/this%20"page".html');
%20 for space character
file_exists works on the file system and not via HTTP. So %20 will not be recognized as space but literally as %20 use spaces instead:
and be sure to use dirname(FILE) to really start from the right folder - this is important if your function call is in an included file ...
file_exists(dirname(__FILE__).'/../data/pages/this page.html')
精彩评论