class Test{
/**
* @param string $name
* @route('test/:name','get')//第二个参数中指定请求类型
* ->http()
* ->pattern(['name'=>'\d+'])
*
*/
public function index($name){
echo '你好 '.$name;
}
}
建议路由定义写在注释最后一段,否则后面需要一个空行
注意在添加路由参数和变量规则的最后不需要加;,并且确保和后面的其它注释之间间隔一个空行。
访问方式:http://localhost/server/public/index.php/test/5654