ip2region_private/binding/php_ext/php5/ip2region
lionsoul b75d215318 Optimize the README DOC 2020-02-21 13:36:21 +08:00
..
lib Optimize the README DOC 2020-02-21 13:36:21 +08:00
tests Optimize the README DOC 2020-02-21 13:36:21 +08:00
.gitignore Optimize the README DOC 2020-02-21 13:36:21 +08:00
CREDITS Optimize the README DOC 2020-02-21 13:36:21 +08:00
README.md Optimize the README DOC 2020-02-21 13:36:21 +08:00
config.m4 Optimize the README DOC 2020-02-21 13:36:21 +08:00
config.w32 Optimize the README DOC 2020-02-21 13:36:21 +08:00
ip2region.c Optimize the README DOC 2020-02-21 13:36:21 +08:00
ip2region.php Optimize the README DOC 2020-02-21 13:36:21 +08:00
php_ip2region.h Optimize the README DOC 2020-02-21 13:36:21 +08:00

README.md

ip2region client - PHP扩展(php5版本)

安装步骤

  • git clone https://github.com/lionsoul2014/ip2region.git

  • cd ip2region

  • cp binding/php_extension/php5/ip2region 到 php source code 的 ext 目录下

  • cp binding/c/ 里面所有的文件到 php source code 的 ext/ip2region/lib 目录下

  • 在 ext/ip2region 下,运行

      phpize
      ./configure
      make && sudo make install
    
  • 配置 ip2region.ini 指定 db_file 路径,(cli/fpm)

      extension=ip2region.so
      ip2region.db_file=/path/to/ip2region.db
    

默认 ip2region.db 在项目根目录下的 data 文件夹下,如有改动,请修改 ip2region.ini 的 db_file

  • 测试

在 ext/ip2region/ 下运行

    php ip2region.php

使用

参考当前目录下的 ip2region.php