@Controller()
注解,主要作用在整个类,用于声明控制器下全部注解路由的前半部分。
场景:声明路由地址。
支持:HTTP
、WebSocket
注解:@Controller()
参数:
prefix=""
<?php
namespace app\http;
use x\controller\Http;
/**
* @Controller(prefix="index")
*/
class Index extends Http
{
/**
* @RequestMapping(route="/test", method="GET", title="我是测试路由")
*/
public function index() {
return $this->fetch('只允许GET,我的路由是:index/test');
}
/**
* @RequestMapping(route="/demo", method="POST")
*/
public function demo() {
return $this->fetch('只允许POST,我的路由是:index/demo');
}
}