require_once __DIR__ . '/src/Router.php';
use XuanYan\Router as Router;
$router = new Router(__DIR__ . '/Controllers');
// set blog module
// handle url like: http://example.com/blog/controller/action, it was a rewrite url
$router->setModule('blog', __DIR__ . '/Blog/Controllers');
// map blog/xuanyan to blogdb/xuanyan
$router->map('blog/:username', 'blogdb/:username');
// if u just want to handler the number you could use :NUM
$router->map('user/:NUM/profile', 'user/profile/:NUM');
// run router
// handle url like: http://example.com/?url=controller/action
// sure, u can use rewrite to let the url seems better
$router->run(@$_GET['url']);
-
Notifications
You must be signed in to change notification settings - Fork 0
xuanyan/Router
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
a simple router for MVC
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published