<?php require('reusable.php'); echo "相对路径加载<br/>"; /* ./ 表示当前文件所在的目录 ../ 表示当前文件所在目录的上一级目录 */ include ("./includedfile.php"); echo "<br/>"; echo "绝对路径加载,__DIR__,方法一<br/>"; include(__DIR__."/includedfile.php"); echo "<br/>"; echo "绝对路径加载,\$_server['DOCUMENT_ROOT'],方法二<br />"; echo "根目录:".$_SERVER['DOCUMENT_ROOT']."<br />"; include($_SERVER['DOCUMENT_ROOT']."/includedfile.php"); ?>
$_SERVER:http://php.net/manual/zh/reserved.variables.server.php