The request behavior for the Yii framework
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist yiier/yii2-request-behavior "dev-master"
or add
"yiier/yii2-request-behavior": "dev-master"
to the require section of your composer.json
file.
Once the extension is installed, simply use it in your Controller code by :
public function behaviors()
{
return [
// code ...
[
'class' => ThrottleBehavior::className(),
'message'=>'您操作太频繁了,10秒内不能重复操作。'
],
];
}
Comments