I have a CLI PHP script and I need to know wh开发者_开发技巧at directory it's currently running in. Because of some operations, including getcwd()
, the directory has changed a bit.
How can I do this?
You can use the __DIR__
predefined constant.
Perhaps you want: dirname(__FILE__)
http://php.net/manual/en/language.constants.predefined.php
精彩评论