Thinkphp method to annotate routing: 1. Open the corresponding tp file; 2. Pass "/* @route('test')*/class Test extends Controller{public function index(){return 'index' ;...}" method to annotate resource routing.
#The operating environment of this tutorial: Windows 10 system, thinkphp version 5, Dell G3 computer.
How to annotate routes in thinkphp?
The code is as follows:
/**注解资源路由 * @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'; } }
Recommended learning: "thinkPHP Video Tutorial"
The above is the detailed content of How to annotate routes in thinkphp. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6
Visual web development tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

WebStorm Mac version
Useful JavaScript development tools
