Laravel提供了向这样的路由添加正则表达式约束的可能性:
Route::get('user/{name}', function($name)
{
//
})
->where('name', '[A-Za-z]+');
Run Code Online (Sandbox Code Playgroud)
也可以为资源创建多个路由:
Route::resource('photo', 'PhotoController');
Run Code Online (Sandbox Code Playgroud)
我想只为路由添加正则表达式约束 GET /photo/{id}
那可能吗?
我尝试从向量中删除元素,并且使用erase()方法工作正常,但在删除元素后,向量的大小仍然相同.
std::vector<int> myvector;
myvector.push_back (1);
myvector.push_back (2);
myvector.push_back (3);//here the size is 3
myvector.erase(myvector.begin()+1);//I think normally the size should be 2 after removing the element
Run Code Online (Sandbox Code Playgroud)
是否有一个功能可以做到这一点或我应该手动完成,我是c ++的新手我检查了文档,我没有找到解决方案.