案例一
代码:
Route::get(’/uuu/{id?}’,function(KaTeX parse error: Expected '}', got 'EOF' at end of input: id=1){ dd(id); })->where(‘id’,’[1-9][0-9a-zA-Z]+’);
运行结果:
案例二:
代码:(用户名+假html)
Route::get(’/login/{name}/123.html’,function(KaTeX parse error: Expected '}', got 'EOF' at end of input: name){ dd(name); })->where(‘id’,’[a-zA-Z]+’);
运行结果:
案例三(十八位身份证):
代码
Route::get(’/SFZ/{id?}’,function(KaTeX parse error: Expected '}', got 'EOF' at end of input: id){ dd(id);
})->where(‘id’,’1\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$’);
运行结果:
1-9 ↩︎