pre*_*eyz 6 regex case-insensitive laravel laravel-4 laravel-routing
如何定义不区分大小写(路径的一部分)?
例:
在路径的固定部分中使用大写字符不起作用:
我理解如何使用{>}等参数使用 - > with()使用正则表达式模式,但这对路由的固定部分没有帮助,如上所述.
这可以通过以下方式定义路由来解决:
Route::get('/{userId}/{profile}')->with('profile', '(?i)profile(?-i)');
Run Code Online (Sandbox Code Playgroud)
更聪明,将其定义为pattern,然后它也可以在路线组中使用.
Route::pattern('profile', '(?i)profile(?-i)');
Route::get('/{userId}/{profile}');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4098 次 |
| 最近记录: |