Life goes on, go go go ...
Previously, there was a reference to the standard library provided by Golang: NET Package
Go Language Learning Net package (the path to go) brief aftertaste net package
func Parseip
Func Parseip (s string) IP
Parseip
This article provides a detailed analysis of the implementation of php based on ip address query in the region where it is located. if you need a friend, refer to the dat file and the information file about the ip address corresponding to the region.
Dat file, information file about the ip corresponding region
Qqwry. dat file
Download it online by yourself
Class file, parse the qqwry. data FileIpLocation. php fileCopy codeThe Code is as follows: Class IpLocation {/*** @ Var resource
This article provides a detailed analysis of the implementation of php Based on ip address query in the region. For more information, see
This article provides a detailed analysis of the implementation of php Based on ip address query in the region.
Php queries the region (pure ip database) based on the ip address ). Pure ip library download? PhpclassIpLocation {*** @ varresource pointer * private $ fp; *** offset address of the first IP record * @ varint * private $ firstip; * ** download the
DAT files, information about IP-corresponding regions
Qqwry.dat file
Download yourself Online
class file, parsing the Qqwry.data file
iplocation.php File
Copy CodeThe code is as follows:
Class Iplocation {
/**
* @var Resource Hands
*/
Private
This approach is not very efficient, if used in the web, if used less can be used in this way, if used, or recommend the use of IP library
Copy Code code as follows:
#region # #得到真实IP以及所在地详细信息
Get real IP and location details
Implementation Method: capture IP addresses through regular expressions to display website data ....
Friendly reminder: This method is not highly efficient. If it is used in the Web, you can use this method if it is rarely used. If it is
This method is not efficient. If it is used in the WEB, you can use this method if it is rarely used. If it is commonly used, it is recommended to use the IP library.Copy codeThe Code is as follows:# Region # obtain the real IP address and location
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.