top-think / think

ThinkPHP Framework ——十年匠心的高性能PHP框架
http://www.thinkphp.cn
Other
7.83k stars 1.62k forks source link

新增控制器请求限制 #977

Closed 9007967 closed 4 years ago

9007967 commented 5 years ago

控制器内写法 class ControllerName extends \app\BaseController { protected $method = [ 'actionName' => ['POST'] ];

public function actionName()
{
        return '验证通过';
}

}

1、未设置的方法所有请求都通过; 2、针对设置的方法,严格按照设置的请求类型进行限制通过; 3、所有操作方法一律使用大写,请参照(GET, POST, PATCH, PUT, DELETE);

liu21st commented 5 years ago

这个还是直接用路由最方便

9007967 commented 5 years ago

主要是 不用路由 非常尴尬