一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

php 取服务器文档根路径

时间:2010-02-19 编辑:简简单单 来源:一聚教程网

/**
 * 取服务器文档根路径
 * @return string
 */
function getRootPath() {
 $sRealPath = realpath('./');
 $sSelfPath = $_SERVER['PHP_SELF'];
 $sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ));
 return substr($sRealPath, 0, strlen($sRealPath) - strlen($sSelfPath));
}

热门栏目