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__)的常量';
}

?>

posted @ 2014-11-10 16:50  ann_glx  阅读(236)  评论(0编辑  收藏  举报