我用apache 和 nginx 配合php判断都能生效的代码在swoole_http_server 里使用判断是不能正常使用的
我用apache 和 nginx 配合php判断都能生效的代码在swoole_http_server 里使用判断是不能正常使用的
<?php
use Swoole\Http\Server;
$http = new Server("127.0.0.1", 9501);
$http->on('request', function ($request, $response) {
$response->end($request->header['user-agent']);
});
$http->start();
你就用$request->header['user-agent']
来判断就可以了
HttpRequest->$header