您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
webman-路由-路由分组 - group嵌套使用
发布时间:2022-01-19 22:32:05编辑:雪饮阅读()
路由配置于config/route.php:
路由除了可以group分组,也可以支持再次嵌套
实例:
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::group('/blog', function () {
Route::group('/v1', function () {
Route::any('/create', function ($rquest) {
return response('blog v1 create');
});
Route::any('/edit', function ($rquest) {
return response('blog v1 edit');
});
Route::any('/view/{id}', function ($rquest, $id) {
return response("blog v1 view $id");
});
});
});
被访问时:
[root@localhost ~]# elinks http://127.0.0.1:8787/blog/v1/create --dump
blog v1 create
[root@localhost ~]# elinks http://127.0.0.1:8787/blog/v1/edit --dump
blog v1 edit
[root@localhost ~]# elinks http://127.0.0.1:8787/blog/v1/view/2 --dump
blog v1 view 2
关键字词:webman,路由,分组,group,嵌套,使用
上一篇:webman-路由-路由参数
下一篇:webman-路由-路由分组