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