我有以下的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