Want to convert IPV4 address to real address, must refer to IP database, commercial IP database stored in relational database, query and use is very convenient, but the cost is not individual and small companies willing to bear, So the idea of
In WEB applications, it is also very common to locate and record access logs based on IP addresses. in ThinkPHP, you can easily obtain and locate ThinkPHP IP addresses.
Can be in the official website http://www.thinkphp1.cn/extend/223.htmldownload
Get IP Address
Copy CodeThe code is as follows:
function GetIP () {
if ($_server["http_x_forwarded_for"])
$ip = $_server["Http_x_forwarded_for"];
else if ($_server["HTTP_CLIENT_IP"])
$ip = $_server["Http_client_ip"];
else if ($_server["REMOTE_ADDR"
ThinkPHP uses the UTFWry address library for IP address locating. The extension class can also be included in the official http://www.thinkphp1.cn/extend/223.htmldownload iplocation extension class library, download expansion package
In WEB applications, it is also very common to locate and record access logs based on IP addresses. in ThinkPHP, you can easily obtain and locate IP addresses at http://www.thinkphp1.cn/extend/223.html) it also contains the extension class. If the
Get IP Address
Copy Code code as follows:
function GetIP () {
if ($_server["http_x_forwarded_for"])
$ip = $_server["Http_x_forwarded_for"];
else if ($_server["HTTP_CLIENT_IP"])
$ip = $_server["Http_client_ip"];
else if
Get IP Address
The code is as follows
Copy Code
function GetIP () {if ($_server["http_x_forwarded_for"])$ip = $_server["Http_x_forwarded_for"];else if ($_server["HTTP_CLIENT_IP"])$ip = $_server["Http_client_ip"];else if (
[Php] obtains the IP address by using the Sina api interface and php to obtain remote data, and obtains the corresponding IP address. this article and [Servlet] Javaweb use the Sina api interface, get the IP address and obtain the corresponding IP
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
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.