快捷路由允许你快速给控制器注册路由,并且针对不同的请求类型可以设置方法前缀,例如:

// 给User控制器设置快捷路由Route::controller('user','index/User');

User控制器定义如下:

namespace app\index\controller;class User {    public function getInfo()
    {
    }    
    public function getPhone()
    {
    }    
    public function postInfo()
    {
    }    
    public function putInfo()
    {
    }    
    public function deleteInfo()
    {
    }
}

我们可以通过下面的URL访问

get http://localhost/user/info
get http://localhost/user/phone
post http://localhost/user/info
put http://localhost/user/infodelete http://localhost/user/info


 小秋同学  路由  2021-03-24 09:37:26    收藏:  赞(905)
学习吧_一个不错的学习网站
本文地址:https://qiuhai.com/doc/1588.html 复制链接 如果还有疑问,欢迎加入我们的QQ交流群:887790 加入Q群 易优最新程序下载: 点击下载
QQ在线咨询