webman的路由只能一行一行的写吗?

a178251115

Route::any('/map', [app\index\controller\Map::class, 'index']);
Route::any('/rss/index', [app\index\controller\Rss::class, 'index']);
Route::any('/rss/baidu', [app\index\controller\Rss::class, 'baidu']);
Route::any('/rss/google', [app\index\controller\Rss::class, 'google']);
Route::any('/rss/sogou', [app\index\controller\Rss::class, 'sogou']);
Route::any('/rss/bing', [app\index\controller\Rss::class, 'bing']);
Route::any('/rss/sm', [app\index\controller\Rss::class, 'sm']);
Route::any('/rss/so', [app\index\controller\Rss::class, 'so']);

Route::any('/index-{page:\d+}', [app\index\controller\Index::class, 'index']);
Route::any('/gbook-{page:\d+}', [app\index\controller\Gbook::class, 'index']);
Route::any('/gbook', [app\index\controller\Gbook::class, 'index']);
Route::any('/topic-{page:\d+}', [app\index\controller\Topic::class, 'index']);
Route::any('/topic', [app\index\controller\Topic::class, 'index']);
Route::any('/topicdetail-{id:\d+}', [app\index\controller\Topic::class, 'detail']);
Route::any('/actor-{page:\d+}', [app\index\controller\Actor::class, 'index']);
Route::any('/actor', [app\index\controller\Actor::class, 'index']);
Route::any('/actordetail-{id:\d+}', [app\index\controller\Actor::class, 'detail']);
Route::any('/actorshow/{area:[\s\S]}-{bllok:[\s\S]?}-{by:[\s\S]?}-{letter:[\s\S]?}-{level:\d+}-{order:[\s\S]?}-{page:\d+}-{sex:[\s\S]?}-{starsign:[\s\S]*?}', [app\index\controller\Actor::class, 'show']);

Route::any('/role-{page:\d+}', [app\index\controller\Role::class, 'index']);
Route::any('/role', [app\index\controller\Role::class, 'index']);
Route::any('/roledetail-{id:\d+}', [app\index\controller\Role::class, 'detail']);
上面是部分路由,写着写着就累了,不知道有没有好的建议

820 2 0
2个回答

Madman

如果没关闭默认路由的话,你这上面有好多根本不用写路由,比如:
Route::any('/map', [app\index\controller\Map::class, 'index']);
Route::any('/rss/index', [app\index\controller\Rss::class, 'index']);
Route::any('/rss/baidu', [app\index\controller\Rss::class, 'baidu']);
Route::any('/rss/google', [app\index\controller\Rss::class, 'google']);
Route::any('/rss/sogou', [app\index\controller\Rss::class, 'sogou']);
Route::any('/rss/bing', [app\index\controller\Rss::class, 'bing']);
Route::any('/rss/sm', [app\index\controller\Rss::class, 'sm']);
Route::any('/rss/so', [app\index\controller\Rss::class, 'so']);
`

Route::any('/index-{page:\d+}', [app\index\controller\Index::class, 'index']);
Route::any('/gbook-{page:\d+}', [app\index\controller\Gbook::class, 'index']);
Route::any('/gbook', [app\index\controller\Gbook::class, 'index']);
Route::any('/topic-{page:\d+}', [app\index\controller\Topic::class, 'index']);
Route::any('/topic', [app\index\controller\Topic::class, 'index']);
Route::any('/topicdetail-{id:\d+}', [app\index\controller\Topic::class, 'detail']);
Route::any('/actor-{page:\d+}', [app\index\controller\Actor::class, 'index']);
Route::any('/actor', [app\index\controller\Actor::class, 'index']);
Route::any('/actordetail-{id:\d+}', [app\index\controller\Actor::class, 'detail']);
Route::any('/actorshow/{area:[\s\S]}-{bllok:[\s\S]?}-{by:[\s\S]?}-{letter:[\s\S]?}-{level:\d+}-{order:[\s\S]?}-{page:\d+}-{sex:[\s\S]?}-{starsign:[\s\S]*?}', [app\index\controller\Actor::class, 'show']);

Route::any('/role-{page:\d+}', [app\index\controller\Role::class, 'index']);
Route::any('/role', [app\index\controller\Role::class, 'index']);
Route::any('/roledetail-{id:\d+}', [app\index\controller\Role::class, 'detail']);

标记的这些都是默认路由已经实现了的

  • Madman 2024-02-27

    哦 看错了,你这是多应用。。。还得在nginx改下。。。

  • a178251115 2024-02-27

    改的tp的,tp 几行代码就搞定了,这里太复杂了

  • Madman 2024-02-27

    webman的路由确实不好用,我也被路由困扰着。。。

  • liong 2024-03-07

    tp的路由确实好用

a178251115

已经放弃了,全手动写不现实,除非只是自己用

  • 暂无评论
×
🔝