PHP to automatically add keyword hyperlink code to the content of the article

Source: Internet
Author: User
Keywords Web Programming PHP Tutorials
Tags array asp code content design echo graphic design html

PHP to add keyword links to the article, like 163 article content automatically add link effect

<?php


$keys =array (


Array (' Web 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 (' Graphic design ', '/fw/photo.html '),


Array (' website ', '/person/'),


Array (' Web making ', '/wy/yw.html '),


Array (' Search engine ', '/seo/seo.html '),


Array (' Optimization ', '/seo/seo.html '),


Array (' animation ', '/flash_a/flash.html '),


Array (' database ', '/database/database.html '),


Array (' Make money ', '/mon/mon.html '),


Array (' Operations ', '/mon/mon.html ')


      


     );


   


$str = "Today is May 30, 2010, my site appears the problem of SEO there are a lot of problems, SEO is the search engine optimization, before learning php good AH now feel jsp good, Css+div, Web, web design, web production, Web learning, Web teaching, Photoshop,flash,html,css,dreamweaver,fireworks,asp,php,jsp,asp.net, website building, website development, web effects, graphic design, personal website, web 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=http://www.jzread.com". $nkeys [1]. "Target=_blank >". $nkeys [0]. "     </a> ", $STR);


     }


    //}


   }


    


Echo $str;


?>


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.