在流明路线上使用正则表达式

Zed*_*Zed 4 regex lumen

我试图使路由的一部分不区分大小写,因此我尝试使用(?i)修饰符以实现以下目的:

(?i)my/route
Run Code Online (Sandbox Code Playgroud)

但是,nikic router流明在使用

$regex .= preg_quote($part, '~');
Run Code Online (Sandbox Code Playgroud)

替换了网址的正则表达式部分,最后我的网址如下所示:

/\(\?i\)my/route
Run Code Online (Sandbox Code Playgroud)

有没有办法将正则表达式放在我不知道的Lumen网址中?

小智 5

这是Lumen处理正则表达式的方式 $app->get('user/{id:[0-9]+}', 'PostController@profile');

https://nikic.github.io/2014/02/18/Fast-request-routing-using-regular-expressions.html