php给文章加关键字连接,163文章内容自动加链接效果
php给文章加关键字连接,像163文章内容自动加链接效果
<?php $keys =array( array('网页特效','/js_a/js.html'), array('seo','/seo/seo.html'), array('php','/phper/php.html'), array('jsp','/jsp/jsp.html'), array('asp','/asp/asp.html'), array('ps','/fw/photo.html'), array('photoshop','/fw/photo.html'), array('javascript','/js_a/js.html'), array('.net','/net/net.html'), array('非主流','/fw/photo.html'), array('网络','/mon/mon.html'), array('css','/cssdiv/css.html'), array('平面设计','/fw/photo.html'), array('网站','/person/'), array('网页制作','/wy/yw.html'), array('搜索引擎','/seo/seo.html'), array('优化','/seo/seo.html'), array('动画','/flash_a/flash.html'), array('数据库','/database/database.html'), array('挣钱','/mon/mon.html'), array('运营','/mon/mon.html') ); $str ="网页特效2008年8月5号seo"; echo $str,"<br>"; foreach($keys as $nkeys){ //print_r($nkeys);echo"<br>"; //foreach( $nkeys as $join) { //echo($join),"<br>"; if(strpos($str,$nkeys[0]) ){ $str =str_replace($nkeys[0],"<a href=http://phprm.com".$nkeys[1]." target=_blank >".$nkeys[0]."</a>",$str); } //} } echo $str;
教程地址:http://www.phprm.com/code/da0a9f31fc9b5e2ec491716100842e07.html
欢迎转载!但请带上文章地址^^