easy-swoole / easyswoole

swoole,easyswoole,swoole framework
https://www.easyswoole.com/
Apache License 2.0
4.73k stars 512 forks source link

在路由匹配时,可否加个后缀,如何加后缀 #561

Closed liwuming closed 1 year ago

liwuming commented 1 year ago

很喜欢easyswoole框架,但在添加路由时遇到一个问题,麻烦会的哥们给看一下呗

使用easyswoole框架制作了个人博客,为了使得对seo更加友好,希望每个链接都是以.html结尾,看起来更像是个静态文件,但是在添加路由时,就无法正常获取参数了,例如:

//优化前,此写法可以正确的获取到author,hash_sha的值
$routeCollector->get('/detail/{author:\w+}/{hash_sha:\w+}','/index/detail');
//优化后,此写法获取到的参数为空
$routeCollector->get('/detail/{author:\w+}/{hash_sha:\w+}.html','/index/detail');

如何给路由添加后缀呢?