Home >Backend Development >PHP Tutorial >PHP regular expression replaces the problem of blank space after site keyword link, regular expression keyword_PHP tutorial
title is not suitable or not. The specific situation is this: the website wants to add a keyword link function, and then the content of the article needs to be matched and replaced with regular expressions, and then the preg_replace function is used. The replaced program code is as follows:
function ReplaceKeyword($linkDefs,$content){ $linkMap = array(); /*foreach($linkDefs as $row) { $linkMap[] = explode(',', $row); }*/ $linkMap = $linkDefs; //Replace the original link with text foreach($linkMap as $row) { $content = preg_replace('/(} The program was found online and tested locally. It was normal. The local environment was PHP 5.3 and the service was 5.2. After uploading it to the Internet, the submission showed blank. At first, I thought it was a PHP version problem and thought it was the difference between ereg and preg. , it still doesn’t work after replacement. Later, when I looked online, I found that some netizens said that just adjusting the pcre.backtrack_limit and pcre.recursion_limit would be enough. I tried it, and it worked. It seems to be a configuration problem, but under normal circumstances, the default configuration of PHP should be fine. The program I wrote myself is still not good enough!
I can write like this. I have tried it with IE6 and FIREFOX 3.0, and there is no problem.