Detecting an IPv6 address in PHP and storing it properly in MySQL. How?

后端 未结 2 605
无人及你
无人及你 2021-01-06 07:30

I read a few of the questions already asked, and i found this to be useful, although i have no tried it Working with IPv6 Addresses in PHP

Still, say i have a \'bans

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-06 08:06

    Still, say i have a 'bans' table in MySQL. How would i go about storing the IPv6 address?

    You can store it in a simple column of VARCHAR(40).
    Considering a sample IPv6 max is 40 byte:

    2001:0DB8:0000:0000:0000:0000:1428:57ab 
    

    That coulmn will be able to contain IPv4 too

提交回复
热议问题