教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 php 取服务器文档根路径

php 取服务器文档根路径

发布时间:2016-10-27   编辑:jiaochengji.com
教程集为您提供php 取服务器文档根路径等资源,欢迎您收藏本站,我们将为您提供最新的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服务器配置信息

[关闭]
~ ~