1
我有以下錯誤:上線410警告:preg_match_all():未知的修飾詞 '4'
Warning: preg_match_all(): Unknown modifier '4' in file.php on line 410
代碼:
preg_match_all("#$replacement_pattern#is", $text, $arr);
是否有人可以幫我解決這個問題?
我有以下錯誤:上線410警告:preg_match_all():未知的修飾詞 '4'
Warning: preg_match_all(): Unknown modifier '4' in file.php on line 410
代碼:
preg_match_all("#$replacement_pattern#is", $text, $arr);
是否有人可以幫我解決這個問題?
這個問題是由於你的情況下有一個非轉義的正則表達式定界符#
引起的。
在行396中,$row['bbcode_in']
是一個簡單的字符串,以及所有#
符號可以逃脫的話,那麼,以後將可以使用#
爲正則表達式的分隔符。
因此,396線必須是這樣的:
$replacement_pattern = str_replace('#', '\\#', trim($row['bbcode_in']));
@ dawidex44:很高興爲你效勞。請考慮接受答案(請參閱[如何接受SO答案](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work))。 –
你能提供足夠的代碼來重現問題,即包括與樣品$文字的$模式,$陣列 –
使用'preg_match_all(「#」。 preg_quote($ replacement_pattern,「#」)。「#is」,$ text,$ arr);' –
所有的代碼在這裏:http://wklej.org/id/3214643/ – dawidex44