Home  >  Article  >  Backend Development  >  PHP数组 为文章加关键字连接 文章内容自动加链接_php技巧

PHP数组 为文章加关键字连接 文章内容自动加链接_php技巧

WBOY
WBOYOriginal
2016-05-17 09:13:46893browse
复制代码 代码如下:

$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;
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn