dirname(__FILE__) 介绍

简单地说:
      __FILE__     返回当前 路径+文件名
      dirname(__FILE__) 返回当前文件路径的 路径部分 (后面没有“\”号)
      dirname(dirname(__FILE__));得到的是文件上一层目录名(不含最后一个“\”号)

<?php
$path = __FILE__;
echo $path;
echo '<br/>';
$path_1 = __DIR__;
echo $path_1;
echo '<br/>';
$path_2 = dirname(__FILE__);
echo $path_2;
echo '<br/>';
$path_3 = dirname(dirname(__FILE__));
echo $path_3;
?>

注意:我使用的windows系统,若是linux系统,其得到的路径“/”。

posted @ 2016-01-26 14:36  侠岚之弋痕夕  阅读(4087)  评论(0编辑  收藏  举报
Where is the starting point, we don't have a choice, but the destination where we can pursue!