From b67e98ad2b2db16aa22e25454ec55eebf4c5ca96 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 20 May 2016 16:28:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BRequest=E7=B1=BB=E7=9A=84root?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Request.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/think/Request.php b/library/think/Request.php index 20e93e3b..d80e5983 100644 --- a/library/think/Request.php +++ b/library/think/Request.php @@ -288,7 +288,11 @@ class Request $this->root = $url; return; } elseif (!$this->root) { - $this->root = rtrim(str_replace('\\', '/', dirname($this->baseFile())), '/'); + $file = $this->baseFile(); + if (0 !== strpos($this->url(), $file)) { + $file = str_replace('\\', '/', dirname($file)); + } + $this->root = rtrim($file, '/'); } return true === $url ? $this->domain() . $this->root : $this->root; }