当前位置:网站首页>Laravel basic course routing and MVC - routing
Laravel basic course routing and MVC - routing
2022-06-26 01:22:00 【DJ Fry】
route
scene : Forward the user's request to the corresponding program for processing ;
effect : establish URL And procedure ( Processing function ) Mapping between ;
type :get,post,put,pathc,delete
route :app/Http/route.php
Basic routing
Route::get('get', function () {
return 'routes test get';
});
Route::post('post', function () {
return 'routes test post';
});
Multi request routing
Route::match(['get', 'post'],'match', function () {
return 'test match multy1';
});
Routing parameters
Route::get('user/{id}', function ($id) {
return 'get id is '.$id;
})->where('id','[0-9]+');
Route::get('user/{name?}', function ($name = null) {
return 'get name is '.$name;
});
Route::get('user/{name?}', function ($name = ' Set the default value ') {
return 'get name is '.$name;
});
Route::get('user/{name?}', function ($name = ' Set the default value ') {
return 'get name is '.$name;
})->where('name','[A-Za-z]+');
/* Set conditions */
Route::get('user/{name}/{id?}', function ($name = 'dename' , $id = 'deid') {
return 'get name is '.$name.' and id is '.$id;
})->where(['id'=>'[0-9]+','name'=>'[A-Za-z]+']);/* Multiple parameters where In array form */
Routing alias
Route::get('/member/member-center', ['as'=>'center',function () {
return 'member-center i am '.route('center');
}]);
routing group
route::group(['prefix'=>'member'],function (){
Route::get('user', function () {
return 'user in member';
});
Route::get('test ', function () {
return 'test in member';
});
http:localhost:8880/member/test
});
Output view in route
Route::get('view', function () {
return view('welcomeroute');
});
Route::get('view2', function () {
return view('layouts');
});
Two calls controller
Route::get('member/info', '[email protected]');
Route::get('member/info1', ['uses'=>'[email protected]']);
Alias
Route::get('member/info2', ['uses'=>'[email protected]','as'=>'memberinfo']);
Parameter binding
Route::get('member/{id}', ['uses'=>'[email protected]'])
->where('id','[0-9]+');
边栏推荐
- 制作3D浪漫炫酷相册【附源码】
- [flower carving experience] 11 start esp32c3
- Using redis database as cache in Django
- 《网络是怎么样连接的》读书笔记 - 集线器、路由器和路由器(三)
- C # operate with MySQL
- [learn FPGA programming from scratch -44]: vision chapter - integrated circuit helps high-quality development in the digital era -1- main forms of integrated circuit chips
- Etcd database source code analysis cluster communication initialization
- mysql错误代码2003的解决办法
- 新库上线 | CnOpenData中国新房信息数据
- Error 65:access violation at 0x58024400: no 'read' permission
猜你喜欢

Nacos registry

The kth largest element in the array

关于HC-12无线射频模块使用

STM32 key development foundation

Essence and thoughts of 30 lectures on product thinking

从查询数据库性能优化谈到redis缓存-谈一谈缓存的穿透、雪崩、击穿

Handling of @charset UTF-8 warning problems during vite packaging and construction;

Qt Cmake 纯C 代码调用系统控制台输入scanf 及 中文输出乱码

返回值为Object型方法调用equals()

制作3D浪漫炫酷相册【附源码】
随机推荐
Chapter VI exercises (678) [microcomputer principles] [exercises]
Qt Cmake 纯C 代码调用系统控制台输入scanf 及 中文输出乱码
2022年电气试验考试试题模拟考试平台操作
2022防爆电气操作证考试题库及模拟考试
Laravel基础课 路由和MVC——控制器
The maze of God's perspective in robot vision
Summary of push-pull output and open drain output of STM32 and failure of analog IIC driving mlx90615
Sword finger offer II 096 String interleaving
Comment promouvoir efficacement les produits
Radio boxes are mutually exclusive and can be deselected at the same time
[Excel知识技能] Excel数据类型
ASP.NET cache缓存的用法
基金开户安全吗?有没有什么风险?
containerd客户端比较
接口的幂等性——详细谈谈接口的幂等即解决方案
QT cmake pure C code calls the system console to input scanf and Chinese output garbled code
Multiple interface calls, using promise all、Promise. Race and promise any
数字电路——加法器
Case: drawing Matplotlib dynamic graph
数据分析——切片器、数据透视表与数据透视图(职场必备)