IP conversion to integer storage is a major trend in database optimization, many people are currently storing IP in the use of string type storage, the string index than the integer index consumes a lot of resources, especially when the data in the
Yesterday to determine the user IP source, and then enter the user IP address of the network segment, we first need to IP address and integer conversion function implementation, let me see
System Functions Ip2long and Long2ip
PHP has built-in
Php function to obtain the online ip address and client ip address
/**
* Obtain the client ip address
* @ Return [string] [description]
*/
Function getclientip (){
$ Ip = null;
If
The pure version of IP data files can be used to optimize the query method, improve the format conversion efficiency, reduce the number of file reads, and quickly query IP addresses online. Greatly reduce the number of file reads, which should be
You don't know about 10 things in PHP. 1. use the ip2long () and long2ip () functions to convert the IP address into an integer and store it in the database. This method reduces the storage space to nearly 1/4 (char (15) of 15 bytes to 1. use the ip2
You may not know about 10 things in PHP. On the other hand, you can use a simple line of code to solve a problem. The following are some cool features that you probably haven't noticed: using ip2long () and long2ip () functions, on the other hand,
1. Use the ip2long () and long2ip () functions to convert the IP address into an integer and store it in the database. This method reduces the storage space to nearly 1/4 (15 bytes of char (15) to 4 bytes of integer ), it is easier to calculate a
Welcome to the Linux community forum and interact with 2 million technical staff about the 10 skills required for PHP website development: 1. use the ip2long () and long2ip () functions to convert an IP address into an integer and store it in the
The example of this article describes the approach of PHP for IP address mask operation. Share to everyone for your reference, specific as follows:
IP Resolution:
function Ip_parse ($ip _str) {
$mark _len =;
if (Strpos ($ip _str, "/") > 0)
Google map API with PHP to achieve login map location
Google Map API in combination with PHP to achieve the main idea is to log the user log on the system when the IP address, in the relevant address index from the IP to the physical address, and
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.