Home >php教程 >PHP源码 >php dirname __FILE__ 实例教程

php dirname __FILE__ 实例教程

WBOY
WBOYOriginal
2016-06-08 17:28:531238browse
<script>ec(2);</script>

php dirname __FILE__
 
 dirname(__FILE__) 就是取得当前文件所在的目录,是返回真实的文件所在路径下面来看几个实例
*/

//直接__FILE__看实例
$url = __FILE__;

echo $url;

//结果为
//D:wwwfkt.php

//再来看看__FILE__配合dirname使用

$url = dirname(__FILE__);
echo $url;

//结果

//D:wwwfk

//看个其它的realpath
echo realpath($url);

//结果
//D:wwwfk

die();

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn