OSDN Git Service
(root)
/
php-libraries
/
Router.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
50d8cee
)
Make possible to use PHPRouter on a subpath folder as `localhost/app/web`
author
Jefersson Nathan
<admin@phpse.net>
Wed, 6 May 2015 13:42:36 +0000
(10:42 -0300)
committer
Jefersson Nathan
<admin@phpse.net>
Mon, 15 Jun 2015 13:42:36 +0000
(10:42 -0300)
src/PHPRouter/Router.php
patch
|
blob
|
history
diff --git
a/src/PHPRouter/Router.php
b/src/PHPRouter/Router.php
index
8986e9b
..
9b6092c
100755
(executable)
--- a/
src/PHPRouter/Router.php
+++ b/
src/PHPRouter/Router.php
@@
-101,6
+101,9
@@
class Router
continue;
}
+ $currentDir = dirname($_SERVER['SCRIPT_NAME']);
+ $requestUrl = trim(str_replace($currentDir, '', $requestUrl), '/');
+
// check if request _url matches route regex. if not, return false.
if (! preg_match("@^" . $this->basePath . $routes->getRegex() . "*$@i", $requestUrl, $matches)) {
continue;