PHP 클래스 yii\filters\VerbFilter

It allows to define allowed HTTP request methods for each action and will throw an HTTP 405 error when the method is not allowed. To use VerbFilter, declare it in the behaviors() method of your controller class. For example, the following declarations will define a typical set of allowed request methods for REST CRUD actions. php public function behaviors() { return [ 'verbs' => [ 'class' => \yii\filters\VerbFilter::className(), 'actions' => [ 'index' => ['get'], 'view' => ['get'], 'create' => ['get', 'post'], 'update' => ['get', 'put', 'post'], 'delete' => ['post', 'delete'], ], ], ]; }
또한 보기: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.7
부터: 2.0
저자: Carsten Brandt ([email protected])
상속: extends yii\base\Behavior
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$actions this property defines the allowed request methods for each action. For each action that should only support limited set of request methods you add an entry with the action id as array key and an array of allowed methods (e.g. GET, HEAD, PUT) as the value. If an action is not listed all request methods are considered allowed. You can use '*' to stand for all actions. When an action is explicitly specified, it takes precedence over the specification given by '*'. For example, php [ 'create' => ['get', 'post'], 'update' => ['get', 'put', 'post'], 'delete' => ['post', 'delete'], '*' => ['get'], ]

공개 메소드들

메소드 설명
beforeAction ( ActionEvent $event ) : boolean
events ( ) : array Declares event handlers for the [[owner]]'s events.

메소드 상세

beforeAction() 공개 메소드

public beforeAction ( ActionEvent $event ) : boolean
$event yii\base\ActionEvent
리턴 boolean

events() 공개 메소드

Declares event handlers for the [[owner]]'s events.
public events ( ) : array
리턴 array events (array keys) and the corresponding event handler methods (array values).

프로퍼티 상세

$actions 공개적으로 프로퍼티

this property defines the allowed request methods for each action. For each action that should only support limited set of request methods you add an entry with the action id as array key and an array of allowed methods (e.g. GET, HEAD, PUT) as the value. If an action is not listed all request methods are considered allowed. You can use '*' to stand for all actions. When an action is explicitly specified, it takes precedence over the specification given by '*'. For example, php [ 'create' => ['get', 'post'], 'update' => ['get', 'put', 'post'], 'delete' => ['post', 'delete'], '*' => ['get'], ]
public $actions