路由简介
请求转化给程序
作用:url和程序之间的映射
请求方式post get put patch delete
eg:
//get请求Route::get('basic1',function(){    return 'hello world';});//多种请求//指定请求方式Route::match(['get','post'],'match',function(){    return 'match';});//不指定Route::any('any',function(){    return 'any';});//路由参数Route::get('user/{id}',function($id){    return 'User-'.$id;});Route::get('user/{id?}/{name?}',function($id,$name){    return 'User-name-'.$name;})->where(['id'=>'[0-9]+','name'=>'[A-Za-z]+']);//请求的路由 http://localhost/public/user/1/w//路由的别名Route::get('user/member-center',['as'=>'center',function(){    return route('center');}]);//路由群组//prefix 前缀Route::group(['prefix'=>'member'],function(){    Route::get('user/center',['as'=>'center',function(){        return route('center');    }]);    Route::get('user/person',['as'=>'person',function(){        return route('person');    }]);});//路由中输出viewRoute::get('view', function () {    return view('welcome'); });以上就是本篇文章的全部内容了。
相关推荐:
laravel5.5框架中视图间如何共享数据?视图间共享数据的两种方法(附代码)
以上就是laravel中路由的代码实例介绍的知识。速戳>>知识兔学习精品课!
