Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Route::get('get/{user_id}-{name?}', function($user_id, $name) { // Do something }
为什么会Route::get('get/{user_id}-{name?}')匹配get/1234?-破折号之前发生了什么{name?},它是如何成为可选的?
Route::get('get/{user_id}-{name?}')
get/1234
-
{name?}
附带问题:大括号中的名称(例如:namein {name})是否可以是任何东西,而不必是传递给路由回调函数的参数名称?
name
{name}