轻源码

  • QingYuanMa.com
  • 全球最大的互联网技术和资源下载平台
搜索
一起源码网 门户 PHPwind专区 查看主题

phpwind9采用纯真IP库的方法

发布者: 938938 | 发布时间: 2018-7-15 02:21| 查看数: 5042| 评论数: 1|帖子模式

  1. public function __construct($dirName = null) {
  2.     $this->_dirName = $dirName ? $dirName : Wind::getRealDir('REP:ipdata');
  3.     $this->_dataFile = $this->_dirName . '/ipindex.dat';
  4.     $this->_wryFile = $this->_dirName . '/wry.dat';
  5.     $this->_from = file_exists($this->_wryFile) ? 'wry' : 'index';
  6. }
复制代码
由上述代码分析得来将ipindex.dat重命名(或删除)然后将纯真IP库(qqwry.dat)复制到/src/repository/ipdata这个目录并重命名成wry.dat
接下来我们修改下源代码src/library/utility/PwIptable.php
定位到第189行或搜索如下代码:
  1. return Pw::convert($country.$area, 'GBK');
复制代码
由于上面的代码没有更新到最新的编码转换接口,我也并没有仔细研究编码转换接口故采用以下的简便方法
  1. //return Pw::convert($country.$area, 'GBK');//将此行注释掉
  2. return iconv('GBK', 'UTF-8', $country.$area);//新增简便返回值(由于纯真IP库默认是GBK的所以要进行编码转换)
复制代码
后台更新缓存,搞定

最新评论

idea123 发表于 2022-7-6 11:20
源代码2剧情

浏览过的版块

轻源码让程序更轻更快

QingYuanMa.com

工作时间 周一至周六 8:00-17:30

侵权处理

客服QQ点击咨询

关注抖音号

定期抽VIP

Copyright © 2016-2021 https://www.171739.xyz/ 滇ICP备13200218号

快速回复 返回顶部 返回列表