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

php dirname __FILE__ 实例教程

WBOY
Release: 2016-06-08 17:28:53
Original
1237 people have browsed it
<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();

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template