【文件属性】:
文件名称:php-routing:PHP 路由库
文件大小:13KB
文件格式:ZIP
更新时间:2021-06-17 13:42:07
PHP
PHP 路由库
路由将请求与将其转换为响应的代码相关联。
下面的示例演示了如何设置一个完整的路由系统:
use Routing\Router;
$host = 'http://domain.tld';
$router = new Router($host);
$router->add('home', '/', 'controller:action');
$router->add('hello', '/hello', 'static:welcome', 'GET');
$router->add('profile', '/user(id:num)', 'profile:index', 'GET|POST');
$route = $router->match('GET', '/user777');
// $route->getController() => 'static:welcome'
【文件预览】:
php-routing-master
----composer.json(566B)
----tests()
--------RouterTest.php(2KB)
--------UrlMatcherTest.php(5KB)
--------RequestTest.php(3KB)
--------UrlGenereatorTest.php(3KB)
----src()
--------Routing()
----.gitignore(3KB)
----phpunit.xml.dist(960B)
----README.md(4KB)
----.gitattributes(483B)