laravel作业
Route::get('/user', function () {
return "<h1>Hello world<h1>";
});
Route::post('/user',function(){
return "<h1>Hello world<h1>";
});
Route::get('/user/{id}',function($id){
return $id;
});
// ### 可选参数
Route::get('/admin/{name?}', function ($name = 'user') {
return $name;
});
###正则表达式
Route::group(['get','post'],function(){
Route::get('/admin',function(){
return 'route by get';
});
Route::post('/admin',function(){
return 'route by post';
});
});
// ### 路由前缀
Route::group(['prefix'=>'admin'],function(){
Route::get('login',function(){
return 'admin/login';
});
Route::get('/logout',function(){
return 'admin/logout';
});
Route::get('/reg',function(){
return "admin/reg";
});
});