拜托,我需要帮助来解决这个问题。我将服务器升级到 php7 后收到此警告。
} elseif (strlen($phrase) == stripos($phrase, '*') + 1) {
$phrase = str_replace('*', '', $phrase);
$collapsed_phrase = explode(' ', $phrase);
if (count($collapsed_phrase) > 1) {
$pattern = '/\b(' . $phrase . '[a-zA-Z0-9]*)/i';
$res = preg_match_all($pattern, $data['adtitle'], $mass);
}
我错误堆栈指向上面的 block 。 提前致谢
最佳答案
问题似乎是 $phrase
中的输入包含特殊字符。为了确保自定义输入不会导致此问题,请始终使用 preg_quote将输入插入正则表达式时。
关于php - preg_match() : Compilation failed: missing ) at offset 14 after i upgraded to php7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38950590/