How to get client IP address in Laravel 5+

前端 未结 18 2735
你的背包
你的背包 2020-11-27 11:11

I am trying to get the client\'s IP address in Laravel.

It is easy to get a client\'s IP in PHP by using $_SERVER[\"REMOTE_ADDR\"]. It is working fine

18条回答
  •  我在风中等你
    2020-11-27 11:53

    When we want the user's ip_address:

    $_SERVER['REMOTE_ADDR']
    

    and want to server address:

    $_SERVER['SERVER_ADDR']
    

提交回复
热议问题