use IlluminateSupportFacadesRoute;
Route::get('/', 'TestController@index');
//基础路由的定义,Route::请求方式('url',匿名函数);Route::请求方式('url','控制器名称@操作方法');
Route::match(['get','post'],'/','TestController@index');
//match用法,中括号内为方式,后面同上
Route::any('/','AbController@user');
Route::any('/aa','TestController@aa');
//any用法,任何方式都可以访问
Route::any('/','TestController@index')->name('aa');
Route::any('/a',function(){
return redirect()->route('aa');
});
//通过在路由定义上链式调用 name 方法可以指定路由名称:
Route::group(['prefix'=>'admin'],function(){
Route::any('/','TestController@index');
Route::any('/','TestController@index1');
Route::any('/','TestController@index2');
});
Route::any('/index/{id}',function($id){
echo '此参数为必填';
});
//路由参数必填
Route::get('/view', function () {
return view('welcome');
});
//直接指向视图