【发布时间】:2011-01-12 04:35:39
【问题描述】:
在PHP中有什么区别
getcwd()
dirname(__FILE__)
当我从 CLI 回显时,它们都返回相同的结果
echo getcwd()."\n";
echo dirname(__FILE__)."\n";
返回:
/home/user/Desktop/testing/
/home/user/Desktop/testing/
哪个是最好用的?有关系吗?更高级的 PHP 开发人员更喜欢什么?
【问题讨论】:
-
别忘了
dirname(__FILE__)和__DIR__一样