开发者

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

开发者 https://www.devze.com 2023-03-12 04:11 出处:网络
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.

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

精彩评论

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