我有以下的WordPress的代码PHP的preg_replace错误WordPress的
function shortcode_parse_atts($text) {
$atts = array();
$pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
$text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text);
if (preg_match_all($pattern, $text, $match, PREG_SET_ORDER)) {
foreach ($match as $m) {
if (!empty($m[1]))
$atts[strtolower($m[1])] = stripcslashes($m[2]);
elseif (!empty($m[3]))
$atts[strtolower($m[3])] = stripcslashes($m[4]);
elseif (!empty($m[5]))
$atts[strtolower($m[5])] = stripcslashes($m[6]);
elseif (isset($m[7]) and strlen($m[7]))
$atts[] = stripcslashes($m[7]);
elseif (isset($m[8]))
$atts[] = stripcslashes($m[8]);
}
} else {
$atts = ltrim($text);
}
return $atts;
}
后,我与一个路径执行的功能,我得到这个错误:
Warning: preg_replace() [function.preg-replace]: Compilation failed: unknown option bit(s) set at offset -1 in /PATH/wp-includes/shortcodes.php on line 258
258线在这里打上
$text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text); //<--- LINE 258
任何人都可以提供任何帮助吗?
,将不胜感激
广东话降级PHP版本...
不知道这是否是问题,但你也可以试试''X的\\ {} HHHH代替'\ x {hhhh}'双引号。 – Passerby 2013-04-05 03:36:44
检查这一个:[不正确的pcre版本] [1]。可能有一些回答您的问题就在这里 [1]:http://stackoverflow.com/questions/9323228/phpinfo-is-reporting-incorrect-pcre-version – 2013-04-05 03:39:34