From 50bb37bd3151cb87e6783f46fe1b67d62d72fb40 Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Tue, 11 Dec 2012 07:23:16 +0000 Subject: [PATCH] * code for task#978. --- framework/helper.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/framework/helper.class.php b/framework/helper.class.php index 885da53a3e..91b97c975f 100644 --- a/framework/helper.class.php +++ b/framework/helper.class.php @@ -521,3 +521,14 @@ function isLocalIP() if($serverIP == '127.0.0.1') return true; return !filter_var($serverIP, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE); } + +/** + * Get web root. + * + * @access public + * @return string + */ +function getWebRoot() +{ + return rtrim(str_replace('\\', '/', pathinfo($_SERVER['PHP_SELF'], PATHINFO_DIRNAME)), '/') . '/'; +}