This commit is contained in:
2021-04-27 11:42:01 +08:00
parent ab81ffd34f
commit ebb3d4c96e
+2 -1
View File
@@ -391,9 +391,10 @@ class Request extends HttpService
/**
* @return mixed|null
*/
public function getIp(): string|null
#[Pure] public function getIp(): string|null
{
$headers = $this->headers->getHeaders();
if (!empty($headers['remoteip'])) return $headers['remoteip'];
if (!empty($headers['x-forwarded-for'])) return $headers['x-forwarded-for'];
if (!empty($headers['request-ip'])) return $headers['request-ip'];
if (!empty($headers['remote_addr'])) return $headers['remote_addr'];