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';
}
}
作者最新文章
安装完wps后office不好用了
2026-11-02 09:50
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
热门文章
更多
精品专题
更多
Mac软件
更多
火山引擎 网页版
Windows/ macOS/ Linux
火山引擎是字节跳动旗下企业级云与AI服务平台。聚焦大模型核心能力,依托字节自研豆包多模态大模型,凭借火山方舟一站式平台,提供模型精调、推理部署、智能应用搭建等全链路服务,结合高性能AI算力,助力各行业快速落地大模型数字化与智能化应用。
















