thinkphp如何注释路由
作者:RainLight
时间:2023-04-27
浏览:3
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';
}
}
作者最新文章
notebooklm网页版登录入口及电脑端打开方法
2026-10-31 18:42
BoBo浏览器极速版安装与横屏锁定设置教程
2026-10-30 10:24
3dmax玻璃材质贴图怎么操作
2026-10-29 12:35
PDF转图片免费版哪款好用?怎么在线把PDF转换成图片?
2026-10-27 11:50
Photoshop图层菜单中没有转换文字图层选项怎么办?
2026-10-23 14:30
热门文章
更多
精品专题
更多
Mac软件
更多
WINDOWS
更多

































