聘我网

新概念招聘3.0

PHP中dirname(__FILE__)与__DIR__是否有区别?

vote up0vote downstar

在我看来是一样的,但为何很多开源项目中经常看到dirname(__FILE__)?

 

1 个答复

vote up0vote downcheck

效果是一样的。而__DIR__是PHP 5.3.0才引进的,所以一些已有的项目中更多看见dirname(__FILE__)

__DIR__ : The directory of the file. If used inside an include, the directory of the included file is returned. This is equivalent to dirname(__FILE__). This directory name does not have a trailing slash unless it is the root directory. (Added in PHP 5.3.0.) (source)

链接

您的回答





不是您要找的问题? 浏览其他含有标签 的问题或者 自己问个.