在使用workerman的時候發(fā)送POST請求,請求的URL帶有query_string參數(shù),但是在請求類里面獲取不到這個query_string參數(shù)。
接收POST請求的URL類似于http://xxx.xxx/index.php?param=value
POST請求體數(shù)據(jù)如下
{"id": 1}
獲取參數(shù)的代碼如下
public function onMessage(\Workerman\Connection\TcpConnection $connection, \Workerman\Protocols\Http\Request $request): void
{
$connection->send($request->uri());
}
發(fā)現(xiàn)返回的uri結(jié)果是/index.php,而不是期望的/index.php?param=value
POST請求一個帶有query_string參數(shù)的URL
通過請求類的uri()方法返回的數(shù)據(jù)沒有帶query_string參數(shù)
Linux CentOS 7.9
PHP 7.4.3
workerman 4.1