我正在使用 laravel 8。在升级到 octane 之前,我在 $_SERVER['REMOTE_ADDR'] 中获取了 IP 地址。更改为辛烷值后,$_SERVER 中没有此类索引。
我在注册控制器的验证器中使用此变量,而新用户正在注册应用程序。
protected function validator(array $data)
{
dd($_SERVER['REMOTE_ADDR'])
}
当我转储 $_SERVER 时,我得到了这个数组(我正在隐藏应用程序详细信息。)
"LARAVEL_OCTANE" =>"1"
"APP_BASE_PATH" => "xxx"
"JOURNAL_STREAM" => "xxx"
"PATH" =>"xxx"
"INVOCATION_ID" => "xxx"
"LANG" => "xxx"
"SUPERVISOR_ENABLED" =>"xxx"
"SUPERVISOR_SERVER_URL" => "xxx"
"SUPERVISOR_PROCESS_NAME" =>"xxx"
"APP_ENV" => "xxx"
"PWD" => "xxx"
"PHP_SELF" => "xxx"
"SCRIPT_NAME" => "xxx"
"SCRIPT_FILENAME" =>"xxx"
"PATH_TRANSLATED" => "xxx"
"DOCUMENT_ROOT" => ""
"REQUEST_TIME_FLOAT" => "xxx"
"REQUEST_TIME" => "xxx"
"argv" => array:2 [▶]
"argc" =>"xxx"
"APP_NAME" => "xxx"
"APP_KEY" => "xxx"
"APP_DEBUG" => "xxx"
"APP_LOG_LEVEL" => "xxx"
"APP_URL" => "xxx"
"OCTANE_SERVER" =>"xxx"
"LOG_CHANNEL" => "xxx"
"DB_CONNECTION" => "xxx"
"DB_HOST" => "xxx"
"DB_PORT" => "xxx"
"DB_DATABASE" => "xxx"
"DB_USERNAME" =>"xxx"
"DB_PASSWORD" => "xxx"
"BROADCAST_DRIVER" => "xxx"
"CACHE_DRIVER" => "xxx"
"SESSION_DRIVER" => "xxx"
"SESSION_LIFETIME" => "xxx"
"QUEUE_CONNECTION" => "xxx"
...............