This extension can set a limiter to user action. 为用户的某种操作设一个一个时间限制。
Documentation ¶
Requirements ¶
- Yii 1.0 or above
Installation ¶
- Extract the release file under
protected/components
- Add componet 'limiter' in main.php
- Create table
[code]
CREATE TABLE IF NOT EXISTS
si_limit
(id
int(11) unsigned NOT NULL AUTO_INCREMENT,action
varchar(200) NOT NULL,hash
varchar(32) NOT NULL,create_time
int(10) unsigned NOT NULL,period
int(10) unsigned NOT NULL,total_times
smallint(5) unsigned NOT NULL,remain_times
smallint(5) unsigned NOT NULL, PRIMARY KEY (id
), UNIQUE KEYhash
(hash
) ) ; [/code]
Usage ¶
See the following code example: ~~~ [code] Yii::app()->Limiter->check(actionName, $params, $period, $total_times); [/code]
[php] Yii::app()->Limiter->spend('actionName', $params); [/php]
Change Log ¶
March 3, 2010 ¶
- Initial release.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.