PHP數(shù)組 為文章加關(guān)鍵字連接 文章內(nèi)容自動加鏈接
更新時間:2011年12月29日 00:51:44 作者:
PHP給文章加關(guān)鍵字連接,像163文章內(nèi)容自動加鏈接效果,其實很多php網(wǎng)站管理系統(tǒng)里面都有,可以參考里面的代碼。
復制代碼 代碼如下:
<?php
$keys =array(
array('網(wǎng)頁特效','/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('網(wǎng)絡(luò)','/mon/mon.html'),
array('css','/cssdiv/css.html'),
array('平面設(shè)計','/fw/photo.html'),
array('網(wǎng)站','/person/'),
array('網(wǎng)頁制作','/wy/yw.html'),
array('搜索引擎','/seo/seo.html'),
array('優(yōu)化','/seo/seo.html'),
array('動畫','/flash_a/flash.html'),
array('數(shù)據(jù)庫','/database/database.html'),
array('掙錢','/mon/mon.html'),
array('運營','/mon/mon.html')
);
$str ="今天是2010年5月30號,我的網(wǎng)站出現(xiàn)的問題這對seo有很多的問題,seo就是搜索引擎優(yōu)化了,以前學php好啊現(xiàn)在覺得jsp好,css+div,網(wǎng)頁,網(wǎng)頁設(shè)計,網(wǎng)頁制作,網(wǎng)頁學習,網(wǎng)頁教學,Photoshop,Flash,HTML,CSS,Dreamweaver,Fireworks,ASP,PHP,JSP,ASP.NET,網(wǎng)站建設(shè),網(wǎng)站開發(fā),網(wǎng)頁特效,平面設(shè)計,個人網(wǎng)站,網(wǎng)頁素材";
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://www.fzitv.net".$nkeys[1]." target=_blank >".$nkeys[0]."</a>",$str);
}
//}
}
echo $str;
?>
您可能感興趣的文章:
相關(guān)文章
php下實現(xiàn)在指定目錄搜索指定類型文件的函數(shù)
php在特定目錄中找特定類型的文件2008-10-10

