swoole過濾多餘請求

swoole過濾多餘請求,這裏舉個栗子,以google瀏覽器多一次favicon.ico請求爲例

<?php
clasee xx{
    public function __construct() {
        .
        .
        .
        .
        .
        .
        $this->ws->on("request", [$this, 'onRequest']);
    }

    public function onRequest($request, $response) {
        if($request->server['request_uri'] == '/favicon.ico') {
			$response->status(404);
			$response->end();
			return;
		}
    }
}




 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章