<?php function sl_wl($log_content,$domain){ preg_match_all('/href="(.*?)"/', $log_content, $matches); if ($matches) { foreach ($matches[1] as $val) { if (strpos($val, $_SERVER['HTTP_HOST']) === false) { $log_content = str_replace('href="'.$val.'"', 'href="'.$val.'" rel="external nofollow" ', $log_content); }else{return $log_content;}}} preg_match_all('/src="(.*?)"/', $log_content, $matches); if ($matches) { foreach ($matches[1] as $val) { if (strpos($val, $domain) === false) { $log_content = str_replace('src="'.$val.'"', 'src="'.$val.'" rel="external nofollow" ', $log_content); }}} return $log_content; }?>
<?php function sl_wl($log_content,$domain){ preg_match_all('/href="(.*?)"/', $log_content, $matches); if ($matches) { foreach ($matches[1] as $val) { if (strpos($val,$_SERVER['HTTP_HOST']) === false) { $log_content = str_replace('href="'.$val.'"', 'href="'.BLOG_URL.'go/?url='.$val.'"', $log_content); }else{return $log_content;}}} preg_match_all('/src="(.*?)"/', $log_content, $matches); if ($matches) { foreach ($matches[1] as $val) { if (strpos($val, $domain) === false) { $log_content = str_replace('src="'.$val.'"', 'src="'.BLOG_URL.'go/?url='.$val.'"', $log_content); }}} return $log_content; }?>
在echo_log.php、page.php中用<?php echo sl_wl($log_content,BLOG_URL);?>替换<?php echo $log_content; ?>即可
站点统计
留言咨询