The PHP array automatically links articles with keywords

  • 2020-05-10 17:52:05
  • OfStack

 
<?php 
$keys =array( 
array(' Web page special effects ','/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(' non-mainstream ','/fw/photo.html'), 
array(' network ','/mon/mon.html'), 
array('css','/cssdiv/css.html'), 
array(' The plane design ','/fw/photo.html'), 
array(' Web site ','/person/'), 
array(' Web page creation ','/wy/yw.html'), 
array(' Search engine ','/seo/seo.html'), 
array(' To optimize the ','/seo/seo.html'), 
array(' animation ','/flash_a/flash.html'), 
array(' The database ','/database/database.html'), 
array(' To earn money ','/mon/mon.html'), 
array(' operating ','/mon/mon.html') 
); 
$str =" Today is 2010 years 5 month 30 No. , My website is having problems with this right seo There are a lot of problems ,seo Search engine optimization , Before learning php Okay, now jsp good ,css+div, Web page , Web design , Web page creation , Web learning , Web teaching ,Photoshop,Flash,HTML,CSS,Dreamweaver,Fireworks,ASP,PHP,JSP,ASP.NET, The website construction , Website development , Web page special effects , The plane design , Personal website , Webpage material "; 
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=//www.ofstack.com".$nkeys[1]." target=_blank >".$nkeys[0]."</a>",$str); 
} 
//} 
} 
echo $str; 
?> 

Related articles: