开发者

Get a local path using PHP

Can I get a path like this using PHP ?

c:\\wamp\\www\\mysite\\blabla\n

from the script running in "mysite" or mysite/blabla

basically I want to f开发者_如何学Pythonind the full file path, not just the one from the server, which in this case is located in www :)


You should use dirname(__FILE__). You can also use just __DIR__ as of PHP 5.3


Really simple!

print $_SERVER['SCRIPT_FILENAME'];


do a print_r on $_SERVER and check it out :)


__FILE__ magic constant. Works for PHP >= 4.0.2

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜