本站所有内容仅限用于学习和研究目的,如有侵权请邮件与我们联系处理!
世上事本无难易,为之则易!

网站首页 站群教程 站群优化教程 正文

给站群程序的模板添加上div模板干扰的php代码

曹操 2022-06-23 站群优化教程 1688 ℃ 0 评论 11537字 free 收藏

很多泛目录程序都给模板添加了干扰码,以小旋风蜘蛛池为例,只要开了模板干扰,就会自动加一些无意义的div参数。

高端的seo一般都知道模板中的class添加随机字母,进行模板伪原创有利于seo优化和收录。

模板伪原创class添加随机字母作用是:让搜索引擎觉得网站的页面模板代码是独一无二的。

我们建站大多数是用各大cms的开源模板或者是cms里面的应用中心购买模板进行建站,这些模板都是成千上万人在用,对于seo优化各大搜索引擎收录和排名不大好(不是唯一不利于优化因素)。

不难发现市面高收录快速出权重的站,偶尔能看到他们的站点的模板里的class标签是有很多不一样的随机字母。

因为最近有小伙伴有这个需求,我就把代码放出来给大家参考。

模板干扰效果图

给站群程序的模板添加上div模板干扰的php代码-第1张图片

模板干扰代码

下面分享Zblog模板中可以调用的div class干扰码php的代码。

function template_class_code_v2($values, $format)       	 	  
{       				 
    global $tp_code_index;     	  		 	
    	 	  			
    if (is_null($tp_code_index)) {    		    		
        $tp_code_index = 0;      	   	 
    }      	 	 		
     				  	
    $classValue = '';    	 	 	  	
    if (isset($values[$tp_code_index])) {    	  			  
        $classValue .= $values[$tp_code_index];      	 	 		
    } else {    	 			  	
        $tp_code_index = 0;      	  	 	
        $classValue .= $values[$tp_code_index];          		
    }    		     	
    if ('unique' != $format) {    		 				 
        $classValue .= '-';    			 	 		
    }    		  	  	
    if (isset($values[$tp_code_index + 1])) {    	  			  
        $classValue .= $values[$tp_code_index + 1];     	 		   
    } else {    			     
        $tp_code_index = 0;      		 			
        $classValue .= $values[$tp_code_index];    			  	  
    }    	       
    if ('unique' != $format) {     	   			
        $classValue .= '-';    		 	 		 
    }    	  	 	 	
    if (isset($values[$tp_code_index + 2])) {       		  	
        $classValue .= $values[$tp_code_index + 2];    		   		 
    } else {    		 	 	  
        $tp_code_index = 0;    		 	    
        $classValue .= $values[$tp_code_index];    		 	 		 
    }    		 	 	 	
    if ('unique' != $format) {     	 			  
        $classValue .= '-';    			 	 	 
    }     				 	 
    if (isset($values[$tp_code_index + 3])) {    				    
        $classValue .= $values[$tp_code_index + 3];      	   	 
    } else {      						
        $tp_code_index = 0;     						 
        $classValue .= $values[$tp_code_index];    				   	
    }    	     		
    $tp_code_index++;    	  		 	 
       		 	 
    return $classValue;    			 	  	
} 
 function template_replace($html)    					 		
{    	 	  		 
    		   	 	
    # 此判断是是防止 zblogx 未初始化导致的 "字符串通过函数调用"    	 			  	
     	      
     
    $mode = 'static';      	    	
    $format = "unique";    	     		
      	 			
    $mode = is_null($mode) ? 'static' : $mode; // 防止更新后默认为动态        		 	
     
       	   	  
    $fullUrl = "http://".$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];   
    
    $string = md5($fullUrl) . sha1($fullUrl);     	  				
    $codeValues = template_text_chunk($string, 2);    	  			  
      	 		 	 
    if ('static' != $mode) {     	  	  	
        shuffle($codeValues); // 非静态重新洗牌     		  	 	
    }     			   	
    		  			 
    # 针对双引号 start-end      		 			
    preg_match_all('/class=\"(.*?)\"/i', $html, $result);     		     
    $class = $result[0];    				  	 
     	   	  
    $html = preg_replace('/class=\".*?\"/', '{FLAG}', $html);
    
    foreach ($class as $item) {    	 		 	 	
        $item = str_replace('"', '', $item);  // 保证 空的 class 能补全    		     	
        $item = str_replace('=', '="', $item);    		 		  	
        $item = str_replace('class="', '', $item);     		   		
        $code = template_class_code_v2($codeValues, $format);    	 	    	
        $newClass = 'class="' . $code . ' ' . $item . '"';   
        
        $html = preg_replace('/\{FLAG\}/', $newClass, $html, 1);       		 	 
    }      	 	 	 
    		   	 	
    # 针对单引号 start-end    	 	  	  
    preg_match_all("/class=\'(.*?)\'/i", $html, $result);     					  
    $class = $result[0];    					 		
    $html = preg_replace("/class=\'.*?\'/", '{FLAG}', $html);       	 	 	
    foreach ($class as $item) {     		  			
        $item = str_replace("'", '', $item);    	 	     
        $item = str_replace('=', "='", $item);     							
        $item = str_replace("class='", '', $item);       		 	 
        $code = template_class_code_v2($codeValues, $format);    		 	    
        $newClass = "class='" . $code . ' ' . $item . "'";    				 			
        $html = preg_replace('/\{FLAG\}/', $newClass, $html, 1);    		 	 	 	
    }      		 	  
    						 	
    return $html;     			  	 
}

如果做正规战一般不建议大家添加这种代码,有时间研究这个,不如根据自己的需要修改一下自己的模板就可以了。

目录导航
  • 模板干扰效果图
  • 模板干扰代码

  • Tags:站群程序泛目录站群小旋风蜘蛛池开源模板

    必看说明

    • 本站中所有被研究的素材与信息全部来源于互联网,版权争议与本站无关。
    • 本站文章或仅为文本内容原创,非程序原创。如有侵权、不妥之处,请联系站长第一时间删除。敬请谅解!
    • 本站所有内容严格遵守国家法律的条例,所有研究的算法技术均来源于搜索引擎公开默认允许用户研究使用的接口。
    • 阅读本文及获取资源前,请确保您已充分阅读并理解《访问曹操SEO网站需知:行为准则》。
    • 本站分享的任何工具、程序仅供学习参考编写架构,仅可在本地的虚拟机内断网测试,严禁联网运行或上传搭建!
    • 任何资源必须在下载后24个小时内,从电脑中彻底删除。不得传播或者用于其他任何用途!否则一切后果用户自负!
    • 转载请注明 : 文章转载自  曹操SEO 给站群程序的模板添加上div模板干扰的php代码
    • 本文标题:《给站群程序的模板添加上div模板干扰的php代码》
    • 本文链接:https://www.ccooc.cn/104.html

    本文暂时没有评论,来添加一个吧(●'◡'●)

    欢迎 发表评论:

    网站分类
    近期评论
    文章归档
    标签列表
    站点信息
    • 文章总数:2005
    • 页面总数:7
    • 分类总数:46
    • 标签总数:336
    • 评论总数:8692
    • 浏览总数:5079362