本文目录一览:
PHP的INCLUDE路径问题
sub06和include不是同级目录吗,不用加路径,直接引就可以了。
<?php
@include("include/subheader.php");
?>
或者-相对麻烦一点的写法
<?php
@include(dirname(dirname(__FILE__)).'/include/subheader.php');
?>
PHP项目,如果我想include一个文件,那路径应该是什么?
php的项目include只能根据你的网站根路径包含。比如网站www文件目录在d盘work下,那么,tp.php包含就是:
include 'tp.php';
php中include('上级目录文件');
当前文件所在目录引用方法为:
<?php
include('test.php');
?>
或者:
<?php
include('./test.php');
?>
上级目录引用方法:
<?php
include('../test.php');
?>
上上级引用方法:
<?php
include('../../test.php');
?>
总结:
其中 .
表示当前目录,..
表示上级目录,/
表示目录分隔符。