thinkphp如何注释路由
作者:RainLight
时间:2023-04-25
浏览: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';
}
}
作者最新文章
音述AI生成歌曲如何一键制作歌词MV
2026-10-10 13:59
photoshop图层样式在哪
2026-10-04 13:45
photoshop路径工具在哪 怎么用
2026-09-16 13:46
PDF怎么批量添加页码?页码位置和起始页怎么设置?
2026-09-04 14:03
GitLab新手创建项目并推送第一次提交的操作指南
2026-09-03 06:05
热门文章
更多
精品专题
更多
Mac软件
更多
WINDOWS
更多










































