<?php
//获取友链favicon站标
function favicon_file($site_url){
$site_url = strtolower(rtrim($site_url,'/'));
$site_md5 = md5($site_url);
$fav_url = TEMPLATE_URL.'favicon/';
$fav_path = TEMPLATE_PATH.'favicon/';
$t = 2592000; //30天,单位:秒
if(!is_file($fav_path.$site_md5.'.png') || (time() - filemtime($fav_path.$site_md5.'.png')) > $t) {
copy('http://www.google.com/s2/favicons?domain='.str_replace('http://','',$site_url),$fav_path.$site_md5.'.png');
}
return $fav_url.$site_md5.'.png';
}?>
<?php echo favicon_file($value['url']); ?>
相关阅读
留言咨询