php 取服务器文档根路径
/**
* 取服务器文档根路径
* @return string
*/
function getRootPath() {
$sRealPath = realpath('./');
$sSelfPath = $_SERVER['PHP_SELF'];
$sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ));
return substr($sRealPath, 0, strlen($sRealPath) - strlen($sSelfPath));
}
您可能感兴趣的文章:
php 取服务器文档根路径
PHP获取当前url路径的函数及服务器变量的例子
php获得网站根目录的几个方法
PHP获取当前页面URL地址程序代码
PHP 获取文件路径(__FILE__的妙用)
PHP获取当前路径和目录的示例
APACHE(2)
php中$_SERVER环境变量用法
linux中PHP dirname(__FILE__)路径问题解决
phpinfo()获取php服务器配置信息