Loading... <div class="tip share">请注意,本文编写于 302 天前,最后修改于 90 天前,其中某些信息可能已经过时。</div> 为了响应国家《互联网用户账号信息管理规定》的相关要求,早就想弄评论显示IP归属地的功能了,最近在[苏晓晴大佬](https://www.blogbig.cn/go/kZ1mLY0t/)的帮助下终于把IP归属地的功能添加上了,把过程记录一下,这里只以handsome主题为例,有区别记得更改。 ## 步骤 1. 找到handsome主题目录 在 `libs`目录下解压如下压缩包 蓝奏云:[IP归属地.zip](https://www.blogbig.cn/go/bdnaEeP9/) 密码:<div class="hideContent">此处内容需要评论回复后(审核通过)方可阅读。</div> 2. 在handsome主题目录下找到文件 `functions.php` 在文件中添加如下代码 ``` require_once("libs/ipdata.class.php"); ``` 如图  3. 在handsome主题目录下找到文件 `functions_mine.php` 在文件中添加如下代码 ``` /** 获取评论者归属地信息 */ function convertip($ip){ echo convertips($ip); } ``` 如图  4. 在 `/component`目录下找到文件 `comments.php` 在 `100行`左右添加如下代码 ``` <?php echo convertip($comments->ip); ?> ``` 如图  5. 刷新查看效果吧! ## 后言 离线IP库与大部分代码均来自于[苏晓晴博客](https://www.blogbig.cn/go/kZ1mLY0t/) 由纯真和zxinc提供离线数据库 支持IPV4 IPV6数据库 ## 推荐阅读 <div class="preview"> <div class="post-inser post box-shadow-wrap-normal"> <a href="https://www.blogbig.cn/archives/iptypechogsd.html" target="_blank" class="post_inser_a no-external-link no-underline-link"> <div class="inner-image bg" style="background-image: url(https://image.blogbig.cn/2022/11/28/1669621124.jpg);background-size: cover;"></div> <div class="inner-content" > <p class="inser-title">Typecho评论显示IP归属地插件【适配ipv6】</p> <div class="inster-summary text-muted"> 闲来有空,于是逛了各位大佬的博客,发现苏晓晴大佬的博客更新IP归属地插件了!!!虽然说网上有handsome主题专... </div> </div> </a> <!-- .inner-content #####--> </div> <!-- .post-inser ####--> </div> 正文到此结束 最后修改:2023 年 06 月 28 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 8 如果觉得我的文章对你有用,请随意赞赏
58 条评论
好,大佬牛批!
顶
支持一波
搬走
我来看看
好,大佬牛批!
好,nb
大佬np
真不错