Skip to content

Commit 8e323f2

Browse files
committed
修复获取IP失败
1 parent 0a64ccb commit 8e323f2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/Foundation/Helpers/functions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function byteConversion($num)
102102
* @return mixed|string
103103
*/
104104
function getClientIp(\Hyperf\HttpServer\Contract\RequestInterface $request){
105-
return $request->getHeaders()['x-real-ip'][0];
105+
return $request->getHeaders()['x-real-ip'][0] ?? '127.0.0.1';
106106
}
107107
}
108108

0 commit comments

Comments
 (0)