thinkphp如何注释路由
作者:RainLight
时间:2023-04-27
浏览:4
thinkphp注释路由的方法:1、打开相应的tp文件;2、通过“/*@route('test')*/classTestextendsController{publicfunctionindex(){return'index';...}”方式注解资源路由即可。代码如下:/**注解资源路由*@route('test')*/classTestextendsController{public
本文目录
thinkphp注释路由的方法:1、打开相应的tp文件;2、通过“/* @route('test')*/class Test extends Controller{public function index(){return 'index';...}”方式注解资源路由即可。
代码如下:
/**注解资源路由
* @route('test')
*/
class Test extends Controller{
public function index(){//test get
return 'index';
}
public function create(){//test/create get
return 'create';
}
public function save(){//test post
return 'save';
}
public function read(){//test/:id get
return 'read';
}
public function edit(){//test/:id/edit get
return 'edit';
}
/** 如果你不想通过资源方式put访问,可以通过注解路由get方式访问
* @route('update','get')
*/
public function update(){//test/:id put 资源路由put方式访问
return 'update';
}
/**
* @route('delete','get')
*/
public function delete(){//test/:id delete
return 'delete';
}
}
作者最新文章
Yandex官网入口及最新访问地址
2026-11-14 12:49
微博怎么成为铁粉:绑定手机号与30天互动规则详解
2026-11-09 17:59
安装完wps后office不好用了
2026-11-02 09:50
notebooklm网页版登录入口及电脑端打开方法
2026-10-31 18:42
BoBo浏览器极速版安装与横屏锁定设置教程
2026-10-30 10:24
热门文章
更多
精品专题
更多
Mac软件
更多
WINDOWS
更多

































