问题
How can I get in PHP the full path to the file?
For example:
/home/yob/public_html/demo/envato/cce/tug/cron/cron.php
I want the folder where the file is:
/home/yob/public_html/demo/envato/cce/tug/cron/
回答1:
PHP < 5.3
$fullpath = dirname(__FILE__);
PHP >= 5.3
$fullpath = __DIR__;
http://php.net/manual/en/language.constants.predefined.php
来源:https://stackoverflow.com/questions/7003491/php-how-to-get-full-path-to-the-file-included-home-and-user