laravel 4 saving ip address to model

后端 未结 3 890
一个人的身影
一个人的身影 2020-12-28 19:11

I\'m trying to save a user ip address to my database using Laravel 4. I found the following function which returns a string

Request::getClientIp()
         


        
3条回答
  •  孤城傲影
    2020-12-28 19:26

    $table->string('ip_address', 39); 
    

    Because the maximum length of an IPv6 address is 39.

    IPv4 will be supported as it's length doesn't exceeds 15.

提交回复
热议问题