IP address location in thinkphp, including IP address library data

Source: Internet
Author: User
IP address location in thinkphp, including IP address library file
a few days ago, the study of the TP in the IP address location, really cost some time, now solved, share to everyone.
IP Address Library A bit large, go here to downloadhttp://download.csdn.net/detail/man_quan/4636418
for IP address positioning, the extracted class library file is placed in the thinkphp/extend/library/org/net (if it does not exist manually created) directory below
then use the Import method to introduce post-operation
    1. import ( ' ORG.Net.IpLocation ' //Import iplocation class
    2. $Ip = new Iplocation ( ' UTFWry.dat ' //Instantiate class parameter represents IP address library file
    3. $area = $Ip -> getlocation ( ' 203.34.5.66 ' //gets the location of an IP address
if the passed-in parameter is empty, the current client IP address is automatically obtained, and the location must be properly output, with the UTF8 encoded IP address library file, or the encoding conversion may be required. The IP address library file and the Iplocation class library are located in the same directory.


  • Related Article

    Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.