Home > Backend Development > PHP Tutorial > PHP: Array Add keyword links to articles, like 163 article content, automatically add link effects

PHP: Array Add keyword links to articles, like 163 article content, automatically add link effects

WBOY
Release: 2016-07-25 09:08:32
Original
931 people have browsed it
PHP: Array Add keyword links to articles, like 163 article content, automatically add link effects
  1. $keys =array(
  2. array('Web page effects','/js_a/js.html'),
  3. array('seo','/seo/seo.html'),
  4. array('php','/phper/php.html'),
  5. array('jsp','/jsp/jsp.html'),
  6. array('asp','/asp/asp.html'),
  7. array('ps','/fw/photo.html'),
  8. array('photoshop','/fw/photo.html'),
  9. array('javascript','/js_a/js.html') ,
  10. array('.net','/net/net.html'),
  11. array('non-mainstream','/fw/photo.html'),
  12. array('network','/mon/mon. html'),
  13. array('css','/cssdiv/css.html'),
  14. array('graphic design','/fw/photo.html'),
  15. array('website','/person/ '),
  16. array('Web page production','/wy/yw.html'),
  17. array('Search engine','/seo/seo.html'),
  18. array('Optimization','/seo/ seo.html'),
  19. array('animation','/flash_a/flash.html'),
  20. array('database','/database/database.html'),
  21. array('make money','/ mon/mon.html'),
  22. array('Operation','/mon/mon.html')
  23. );
  24. $str = "Today is May 30, 2010. There is a problem with my website. There are many questions about seo. seo is search engine optimization. I used to learn php, but now I think jsp is better, css+div, web page, web design, web page production, web page learning, web page teaching, Photoshop, Flash, HTML, CSS, Dreamweaver,Fireworks,ASP,PHP,JSP,asp.net,website construction,website development,webpage special effects,graphic design,personal website,webpage materials";
  25. echo $str,"
    ";
  26. foreach( $keys as $nkeys){
  27. //print_r($nkeys);echo"
    ";
  28. //foreach( $nkeys as $join) {
  29. //echo($join),"
    ";
  30. if(strpos($str,$nkeys[0]) ){
  31. $str =str_replace($nkeys[0],"".$nkeys[0]."",$str);
  32. }
  33. //}
  34. }
  35. echo $str;
  36. ?>
Copy code


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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template