Router.php 594 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace EasySwoole\Http\Tests\ControllerWithRouter;
  3. use EasySwoole\Http\AbstractInterface\AbstractRouter;
  4. use EasySwoole\Http\Request;
  5. use EasySwoole\Http\Response;
  6. use FastRoute\RouteCollector;
  7. class Router extends AbstractRouter
  8. {
  9. public function initialize(RouteCollector $routeCollector)
  10. {
  11. $routeCollector->get('/', function (Request $request, Response $response) {
  12. $response->write('the router get /');
  13. return false;
  14. });
  15. $routeCollector->get('/user/{name}','/Index/user');
  16. // $this->setGlobalMode(true);
  17. }
  18. }