Website articles automatically add links within the site. I think most of my classmates’ websites have this function. The editor below summarizes three functions for automatically adding links within the article. From top to bottom, the best method is at the top.
Example 1
The code is as follows | Copy code | ||||
|
Example 2
The code is as follows | Copy code |
class InnerLink{ |
Example 3
This was written when I first learned PHP, and I felt there was something wrong with it
代码如下 | 复制代码 |
$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 ="今天是2010年5月30号,我的网站出现的问题这对seo有很多的问题,seo就是搜索引擎优化了,以前学php好啊现在觉得jsp好,css+div,网页,网页设计,网页制作,网页学习,网页教学,Photoshop,Flash,HTML,CSS,Dreamweaver,Fireworks,ASP,PHP,JSP,ASP.NET,网站建设,网站开发,网页特效,平面设计,个人网站,网页素材"; echo $str," "; foreach($keys as $nkeys){ //print_r($nkeys);echo" "; //foreach( $nkeys as $join) { //echo($join)," "; if(strpos($str,$nkeys[0]) ){ $str =str_replace($nkeys[0],"".$nkeys[0]."",$str); } //} } echo $str; ?> |