目前默认的是 Content-Type: text/html;charset=utf-8 ,如何修改为 application/json
// 监听一个http端口 $inner_http_worker = new Worker($httpWorkUrl); // 当http客户端发来数据时触发 $inner_http_worker->onMessage = function ($http_connection, $data) { $http_connection->setHeader('Content-Type', 'application/json'); return $http_connection->send($data); }
但是没有效果
http://doc.workerman.net/http/response.html
@1393:我这边是phpsocketio,如果按照这个来,我response文件都没有
刚自己解决了,要感谢@six给了方向
\Workerman\Protocols\Http::header('Content-Type:application/json; charset=utf-8'); return $http_connection->send($data);
https://wenda.workerman.net/question/3972
// 监听一个http端口
$inner_http_worker = new Worker($httpWorkUrl);
// 当http客户端发来数据时触发
$inner_http_worker->onMessage = function ($http_connection, $data) {
$http_connection->setHeader('Content-Type', 'application/json');
return $http_connection->send($data);
}
但是没有效果
http://doc.workerman.net/http/response.html
@1393:我这边是phpsocketio,如果按照这个来,我response文件都没有
刚自己解决了,要感谢@six给了方向
https://wenda.workerman.net/question/3972