An internal link of php development articles to replace rules

Source: Internet
Author: User
Php develops the article internal chain, replacing the rule with a problem as the internal chain method, you can think of replacing & nbsp; set the internal chain word, such as the & nbsp; replace "Spring Festival holiday" with "& nbsp;" & lt; a & nbsp; href = '##' & gt; Spring Festival holiday & lt;/a & gt; ", etc. this method may come, but the fact is that there may be no internal link for php development, which is a problem of replacing rules.
The internal chain method can be used to replace the configured internal chain words, such as replacing "Spring Festival holiday" with "Spring Festival holiday ".

However, the fact may not be that simple, because the posts are often labeled with html, for example, "Spring Festival Holiday"How to replace this form?

I thought there may be a possibility of concentrated below

The "Spring Festival holiday" is to be replaced"

This direct form of "Spring Festival holiday" is not replaced

"Spring Festival holiday" is not replaced

Some words like "Spring Festival holiday" are linked and not replaced

... He may be replaced.

In the language description, "each word is replaced without a link. the link may be a direct link or a tag link"

Then replace it with "the nearest parent node with multiple word segmentation, and replace it with the new form of link addition ".

What about this matching rule and replacement rule? Help php seo internal chain
------ Solution --------------------
What you think is too complicated. you do not need to replace the html-marked package.
Because the mark may have been given a specific meaning, for example, the mark is a connection.
Although you think it is very complicated, there is another one that is not taken into account (marked ):
Spring Festival holidays> Spring Festival holidays
Example
$ Html = <
 Here is the link to tea.

Chinese tea
Here is the link to the Chinese tea big view.
Here is the existing link of tea
Html;
Echo preg_replace ('#(? = [^>] * (? = <(?! /A>)
------ Solution --------------------
$) Tea # ',' \ 0', $ html );
Get

Here is the link to tea.

Chinese tea
Here is the link to the Chinese tea big view.
Here is the existing link of tea

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.