dirname(__FILE__)与__DIR__全等

小例子如下:

<?php
$the_full_name = __FILE__;
$the_file = dirname(__FILE__);
echo $the_full_name.'<br/>'.$the_file.'<br/>';
$the_new_name = __DIR__;
$the_dir = dirname(__DIR__);
echo $the_new_name.'<br/>'.$the_dir.'<br/>';
if($the_file === $the_new_name){
echo '__DIR__是代替dirname(__FILE__)的常量';
}

?>

原文地址:https://www.cnblogs.com/anns/p/4087557.html