开发者

Get a local path using PHP

开发者 https://www.devze.com 2023-03-30 19:15 出处:网络
Can I get a path like this using PHP ? c:\\\\wamp\\\\www\\\\mysite\\\\blabla\\n from the script running in \"mysite\" or mysite/blabla

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

精彩评论

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