Open yemaozi999 opened 6 months ago
$http_worker = new Worker('http://0.0.0.0:2883'); $http_worker->onMessage = function (\Workerman\Connection\TcpConnection $connection, \Workerman\Protocols\Http\Request $request) { $get = $request->get(); $post = $request->post(); $header = $request->header(); $data = [ 'header' => $header, 'get' => $get, 'post' => $post, 'method'=> $request->method(), 'uri'=>$request->uri(), 'path'=>$request->path() ]; }
}
$request->uri(); 有值 $request->path(); 为空 有问题 应该是 /hpt/v1/CurrentTime
结果:
{ "get": [], "post": { "ICCID": "", "ICCID2": "" }, "method": "POST", "uri": "/:80/hpt/v1/CurrentTime", "path": "" }
uri 有值不代表 path就一定有值。 /:80/hpt/v1/CurrentTime 这种不是合法的path地址
/:80/hpt/v1/CurrentTime
}
$request->uri(); 有值 $request->path(); 为空 有问题 应该是 /hpt/v1/CurrentTime
结果:
{ "get": [], "post": { "ICCID": "", "ICCID2": "" }, "method": "POST", "uri": "/:80/hpt/v1/CurrentTime", "path": "" }