When I add an article, I need to automatically generate the anchor text. When the keyword matches the content of the article, the alt and title values of img will be matched, and an exception will occur in the image. Please help me solve it! Thank you! What I originally wanted was & amp; lt; p & amp; gt; & amp; lt; imgtitle & #039; xxx & #039; & amp; gt; link these words... when I add an article, I need to automatically generate the anchor text. When the keyword matches the content of the article, the alt and title values of img will be matched, and an exception will occur in the image.
Please help me solve it! Thank you!
What I originally wanted was
Add links to these texts
Error content:
My code is written as follows:
/*** Replace multiple keywords, replace each time * @ param Mixed $ search finds the target value * @ param Mixed $ replace the replacement value * @ param Mixed $ subject executes the replacement string/array * @ param Int $ limit allows replacement times, default Value:-1, unlimited number of times * @ return Mixed */function str_replace_limit ($ search, $ replace, $ subject, $ limit =-1) {if (is_array ($ search )) {foreach ($ search as $ k => $ v) {$ search [$ k] = '''. preg_quote ($ search [$ k], '''). ''' ;}} else {$ search = '''. preg_quote ($ search ,'''). ''';} return preg_replace ($ search, $ replace, $ subject, $ limit);} foreach ($ keylink as $ k) {$ keyArray [] = $ k-> word; $ url = 'url. '"style =" color: red; font-size: 1.2em; "> '. $ k-> word. ''; $ replacement [] = $ url ;}
Reply content:
When I add an article, I need to automatically generate the anchor text. When the keyword matches the content of the article, the alt and title values of img will be matched, and an exception will occur in the image.
Please help me solve it! Thank you!
What I originally wanted was
Add links to these texts
Error content:
My code is written as follows:
/*** Replace multiple keywords, replace each time * @ param Mixed $ search finds the target value * @ param Mixed $ replace the replacement value * @ param Mixed $ subject executes the replacement string/array * @ param Int $ limit allows replacement times, default Value:-1, unlimited number of times * @ return Mixed */function str_replace_limit ($ search, $ replace, $ subject, $ limit =-1) {if (is_array ($ search )) {foreach ($ search as $ k => $ v) {$ search [$ k] = '''. preg_quote ($ search [$ k], '''). ''' ;}} else {$ search = '''. preg_quote ($ search ,'''). ''';} return preg_replace ($ search, $ replace, $ subject, $ limit);} foreach ($ keylink as $ k) {$ keyArray [] = $ k-> word; $ url = 'url. '"style =" color: red; font-size: 1.2em; "> '. $ k-> word. ''; $ replacement [] = $ url ;}
Can you see the code?