larave路由的路由入门
1,简单实例
最基本的 Laravel 路由只接收一个 URI 和一个闭包,并以此为基础提供一个非常简单优雅的路由定义方法:
Route::get('hello', function () {
return 'Hello, www.dgqiye.com.cn';
});
2,我们可以注册路由来响应任何 HTTP 请求动作
1,get方法
Route::get($uri, $callback);
2,post方法
Route::post($uri, $callback);
3,put方法
Route::put($uri, $callback);
4,patch方法
Route::patch($uri, $callback);
5,delete方法
Route::delete($uri, $callback);
6,options 方法
Route::options($uri, $callback);
7,match 方法
Route::match(['get', 'post'], 'foo', function () {
return 'This is a request from get or post';
});
8,any 方法
Route::any('bar', function () {
return 'This is a request from any HTTP verb';
});