开发者

How can I get the dir of a php script that's running in CLI?

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜