操作步骤
将下方代码添加到functions.php文件里(/zibll/functions.php)
//获取地址
function xypro_user_ip($user_ip){
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => "https://v1.21lhz.cn/API/IP/api.php?domian=".$user_ip,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_HTTPHEADER => array(
"Content-Type: application/x-www-form-urlencoded",
),
));
$url = curl_exec($ch);
$a = json_decode($url,true);
curl_close($ch);
$dizhi = $a['country'];
$dizhi = mb_substr($dizhi, 0, 3, 'utf-8');
return $dizhi;
//获取结束
}
这里需要到zib-comments-list.php修改(在zibll/inc/functions),先搜索$replyText_html跳到第二个,然后粘贴下方的代码覆盖它即可!
$user_ip = $comment->comment_author_IP;
$replyText_html = '<span class="reply-link">' . $replyText . '</span><span style="cursor:pointer" data-toggle="tooltip" alt="IP:'.$user_ip.'" data-original-title="IP地址:'.xypro_user_ip($user_ip).'">'.xypro_user_ip($user_ip).'</span>';
微信扫描下方的二维码阅读本文
© 版权声明
THE END
暂无评论内容