Loading... 1. 操作前请做好相应备份工作 2. 此插件只适用于Handsome主题,未对其它主题优化!!! 3. 请先将插件置于Typecho的plugins目录下,且插件目录名应为UserAgent,注意大小写,否则将无法正常使用!!! 4. 修改Handsome主题,component目录下的comments.php代码文件,大概第60~80行左右, ```````````` <span class="comment-author vcard"> <b class="fn"><?php echo $author; ?></b><?php echo $Identity; ?></span> ```````````` 添加代码 `````````````````````````````````````````````````````````````````````````` <?php UserAgent_Plugin::get_useragent($comments->agent,$comments->ip); ?> `````````````````````````````````````````````````````````````````````````` 修改后代码如下: ```````````` <span class="comment-author vcard"> <b class="fn"><?php echo $author; ?></b><?php echo $Identity; ?> <?php UserAgent_Plugin::get_useragent($comments->agent,$comments->ip); ?></span> ```````````` 获取真实IP Typecho开启CDN后,可能无法获取访客真实IP,只能取得CDN节点IP,为此可以在Typecho博客网站的根目录的config.inc.php插入下面的代码: ```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````` //** 防止CDN造成无法获取客户真实IP地址 */ if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']); $_SERVER['REMOTE_ADDR'] = $list[0]; } ```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````` 下载地址: <a href="https://www.dmgls.com/usr/uploads/2020/07/3796017502.zip">UserAgent.zip</a> <hr class="content-copyright" style="margin-top:50px" /><blockquote class="content-copyright" style="font-style:normal"><p class="content-copyright">版权属于:大漠孤狼</p><p class="content-copyright">本文链接:<a class="content-copyright" href="https://www.dmgls.com/955.html">https://www.dmgls.com/955.html</a></p><p class="content-copyright">转载时须注明出处及本声明</p></blockquote> Last modification:July 25th, 2020 at 03:21 pm © 允许规范转载 Support 如果觉得我的文章对你有用,请随意赞赏 ×Close Appreciate the author Sweeping payments