首页HTTP 响应Code429
Code429
限流响应:渲染 TEMPLATE_RESPONSE_429 模板
类定义
namespace Kuoqi\Core\Response;

use Kuoqi\Core\File;
use Kuoqi\Core\View;

class Code429 extends Behavior {
    protected $STATUS_CODE = 429;

    public function __construct(){
        parent::__construct();
        $view = new View(
            (new File(\Kuoqi::$TEMPLATE_RESPONSE_429))->getContent(),
            array()
        );
        $this->stream = $view->toStream();
    }

    public function flush(){
        parent::flush();
    }
}

模板定制

说明
Kuoqi::$TEMPLATE_RESPONSE_429默认 {@CORE}/Template/Response/Code429.template,可手动重新定制
渲染方式File 读取模板内容 + View 渲染(支持 {$var} 等模板语法)
典型用法
// 限流检测(Helper::speedLimit 思路)
if($this->isSubmit(2000)){
    (new \Kuoqi\Core\Response\Code429())->flush();
}
KuoqiPHP v1.05 · 离线静态文档 · 界面基于 KuoqiUI · 返回首页