PHP Development article within the chain, a problem with the replacement rule
Do the inner chain method, can think of is to replace the set of good inner chain words, such as the "Spring Festival holiday" replaced with "Spring Festival Holiday", and so on, this way to
But the fact may not be so simple, because the article is often sent with HTML tags, such as may be " Spring Festival
Holiday"In this form, how to replace it?"
Thought maybe there might be a concentration below.
"Spring Festival Holiday"This is to be replaced, into such a" spring festival Holiday”
This direct form of "Spring Festival Holiday" does not replace
“ Spring FestivalHoliday "This type of label is not replaced
"Spring Festival Holiday" This part of the word has a link does not replace
。。。 Maybe there's a situation for him.
In the language description, "Every word is replaced without a link, the link may be a direct link may also be a tag link"
Then replace it with "multiple word breakers within the nearest parent node, replacing the new form with the newly Added link".
How do you write the matching rules and the substitution rules? Help PHP SEO Inner Chain
------Solution--------------------
You're so complicated, you don't need to be replaced by HTML tags.
Because the tag may have been given a specific meaning, such as a tag is a connection
Although you think it is very complicated, but there is another place not to consider (inside the tag):
Spring Festival Holiday' > Spring Festival Holiday
Example
$html = <<
<>
Here is the link to the tea.
Chinese tea
Here is a link to the Chinese tea panorama.
Here is the existing link to the tea
html
echo preg_replace (' # =[^>]* (?=< (?! /a>)
------Solution--------------------
($)) Tea # ', ' (') ', $html);
Get
Here is the link to the tea.
Chinese Tea
Here is a link to the Chinese tea panorama.
Here is the existing link to the tea