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