在使用workerman的時(shí)候發(fā)送POST請(qǐng)求,請(qǐng)求的URL帶有query_string參數(shù),但是在請(qǐng)求類里面獲取不到這個(gè)query_string參數(shù)。
接收POST請(qǐng)求的URL類似于http://xxx.xxx/index.php?param=value
POST請(qǐng)求體數(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請(qǐng)求一個(gè)帶有query_string參數(shù)的URL
通過請(qǐng)求類的uri()方法返回的數(shù)據(jù)沒有帶query_string參數(shù)
Linux CentOS 7.9
PHP 7.4.3
workerman 4.1