workman,events.php中怎么获取服务端IP

yuan521

已经测试 $_SERVER['SERVER_ADDR'] 不可用

阅读 97
1个回答

Tinywan

以下为使用阿里云SLB获取

$_SESSION['client_ip'] =  $data['server']['HTTP_X_FORWARDED_FOR'] ?? $data['server']['HTTP_REMOTEIP'] ?? '127.0.0.1';