如何在PHP中获取文件的完整路径?
例如:
/home/yob/public_html/demo/envato/cce/tug/cron/cron.php
Run Code Online (Sandbox Code Playgroud)
我想要文件所在的文件夹:
/home/yob/public_html/demo/envato/cce/tug/cron/
Run Code Online (Sandbox Code Playgroud)
PHP <5.3
$fullpath = dirname(__FILE__);
Run Code Online (Sandbox Code Playgroud)
PHP> = 5.3
$fullpath = __DIR__;
Run Code Online (Sandbox Code Playgroud)
http://php.net/manual/en/language.constants.predefined.php