开发者

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')
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜