@RequestMapping()
注解,主要用于绑定请求的路由地址。
场景:声明路由地址。
支持:HTTP
、WebSocket
注解:@RequestMapping()
参数:
route=""
method=""
|
号间隔,例如:method="GET|POST"
。不限制
,非必填method=""
无
,非必填<?php
namespace app\http;
use x\controller\Http;
class Index extends Http
{
/**
* @RequestMapping(route="index/test", method="GET", title="我是测试路由")
*/
public function index() {
return $this->fetch('只允许GET,我的路由是:index/test');
}
/**
* @RequestMapping(route="index/demo", method="POST")
*/
public function demo() {
return $this->fetch('只允许POST,我的路由是:index/demo');
}
}