walkor / workerman

An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols.
http://www.workerman.net
MIT License
11.03k stars 2.25k forks source link

$request->path() 有问题 #1035

Open yemaozi999 opened 1 month ago

yemaozi999 commented 1 month 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": "" }

walkor commented 1 month ago

uri 有值不代表 path就一定有值。 /:80/hpt/v1/CurrentTime 这种不是合法的path地址