Route路由

自定义路由 {#1自定义路由}

动态参数绑定 {#2动态参数绑定}

restful API 风格 {#3restful-api-风格}

  1. <?php
  2. return array(
  3. 'homepage'=>[
  4. 'pattern' => '/',
  5. 'controller' => 'Web:Home:Default:index',
  6. ],
  7. 'group'=>[
  8. 'pattern' => '/group/{id}',
  9. 'controller' => 'Web:Group:Group:test',
  10. 'methods' => 'GET',
  11. ],
  12. 'create_group'=>[
  13. 'pattern' => '/group/{id}',
  14. 'controller' => 'Web:Group:Group:index',
  15. 'methods' => 'POST',
  16. ],
  17. 'user_group'=>[
  18. 'pattern' => '/user/{id}/group/{groupId}',
  19. 'controller' => 'Web:Group:Group:test',
  20. 'methods' => 'GET',
  21. ],
  22. );

多个分组路由配置config/routing.php {#4多个分组路由配置configroutingphp}

Route对象使用 {#5route对象使用}

Route::deParse($alias, $parameters = []);

根据别名反解析路由