Explaining request for help in the Aura router.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // router instantiation | |
| $uri = $_SERVER['REQUEST_URI']; | |
| $request = strip_query($uri); | |
| $request_arr = explode('/', urldecode($uri)); | |
| foreach ($request_arr as &$param){ | |
| $param = ucfirst($param); | |
| } | |
| $class = 'MyApp\\'.implode('\\', $request); | |
| // Check for existence of a direct class (db, ajax or other non-page routers) | |
| if (class_exists($class)){ | |
| return $class; | |
| } | |
| /* | |
| So a call to | |
| domain.com/path/to/route | |
| Would attempt to find a class | |
| MyApp\Path\To\Route | |
| Wheras a call to | |
| domain.com/this/is/a/route | |
| Would search for a class | |
| MyApp\This\Is\A\Route | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment