售价:2 积分
开通青铜VIP或更高级的会员可免费查看该内容
效果图:
网站友情链接是每个站都会有的,但是很多站长在链接后并不是很关注友联网站,或是很长一段时间才检查链接是否正常,此教程可以直接在友情链接页面显示连接是否正常,非常不错,之前也分享过类似的友联检查教程喜欢的自己搜索本站即可。
使用教程:
文件路径:Joe-master/
1.第一段 <?php $max_allow_links = 100; // 最大许可检查的链接数目 function my_file_get_contents($url, $timeout = 30) { if (function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $file_contents = curl_exec($ch); curl_close($ch); } else if (ini_get('allow_url_fopen') == 1 || strtolower(ini_get('allow_url_fopen')) == 'on') { $file_contents = @file_get_contents($url); } else { $file_contents = ''; } return $file_contents; } function isExistsContentUrl($url, &$retMsg, $mydomain = "") { if (!isset($url) || empty($url)) { $retMsg = "配置URL为空"; return false; } if (!isset($mydomain) || empty($mydomain)) { $mydomain = $_SERVER['SERVER_NAME']; } $resultContent = my_file_get_contents($url); if (trim($resultContent) == '') { $retMsg = "网站无法访问"; return false; } if (strripos($resultContent, $mydomain)) { $retMsg = "友链正常"; return true; } else { $retMsg = "未添加本站"; return false; } } ?> 2.第二段 $friendsUrl = explode("||", $friends_arr[$i])[4]; if($friendsUrl) { $friends[] = array("name" => trim($name), "url" => trim($url), "avatar" => trim($avatar), "desc" => trim($desc), "friendsUrl" => trim($friendsUrl)); } else { $friends[] = array("name" => trim($name), "url" => trim($url), "avatar" => trim($avatar), "desc" => trim($desc), "friendsUrl" => trim($url)); } 3.第三段 <span class="title" style="float: right;<?php if(Helper::options()->JFriendsSwitch !== 'on') echo 'display:none;' ?>"> <?php if(Helper::options()->JFriendsSwitch !== 'off') { $result = ""; $ret = isExistsContentUrl($item['friendsUrl'], $result, null); echo $result; } ?> </span>
文件路径:Joe-master/
在主题中开启此功能后,需要在友链配置最后增加一个友链界面的链接,如果没有友链页面可不添加
还没有评论,来说两句吧...