From b8d97728b06eff47fd16fe17dfb31d147b44d18e Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 21 Feb 2013 01:21:26 +0000 Subject: [PATCH] * fix a bug for get webroot in shell. --- framework/helper.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/helper.class.php b/framework/helper.class.php index fd5faa3ce7..5a27b026a7 100644 --- a/framework/helper.class.php +++ b/framework/helper.class.php @@ -545,7 +545,8 @@ function getWebRoot() if(defined('IN_SHELL')) { $url = parse_url($_SERVER['argv'][1]); - $path = $url['path']; + $path = empty($url['path']) ? '/' : rtrim($url['path'], '/'); + $path = empty($path) ? '/' : $path; } return substr($path, 0, (strrpos($path, '/') + 1)); }