Home > php教程 > PHP源码 > PHP数组 为文章加关键字连接 文章内容自动加链接_php技巧

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

PHP中文网
Release: 2016-05-25 17:07:13
Original
1054 people have browsed it

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','/cssp/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+p,网页,网页设计,网页制作,网页学习,网页教学,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;
?>

Related labels:
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template