Skip to content
导航目录

注解路由

注解路由

tp6路由文档:https://doc.thinkphp.cn/v8_0/annotations_route.html

1. 使用方式

  • 使用group进行路由分组,使用Route设置路由规则
ts
<?php
namespace app\controller;

use think\annotation\route\Route;

class Index
{
    /**
     * @param  string $name 数据名称
     * @return mixed
     */
    #[Route("GET", "hello/:name")]
    public function hello($name)
    {
    	return 'hello,'.$name;
    }
}

欢迎使用HardAdmin