我使用一个论坛脚本。它适用于php5.4中的下面脚本。但是,如下图所示,出现php5.5问题。 error http://oi60.tinypic.com/k0hyfq.jpg
可在此处找到全尺寸图片:http://oi60.tinypic.com/k0hyfq.jpg。
代码:
// replace RE: RE: RE: by RE[3]:
$this->subject = preg_replace('/(^RE: RE\[)(\d+)(?=\]:)/ie', '"RE[".(\\2+1)', $this->subject);
$this->subject = preg_replace('/^(RE: RE:(?: RE:)+)/ie', '"RE[".substr_count("\\1", "RE:")."]:"', $this->subject);
答案 0 :(得分:0)
我们已按如下方式更改了代码。目前没有问题
代码:
$tempSubject = $this->subject;
$tempSubject = preg_replace_callback('/(^RE: RE\[)(\d+)(?=\]:)/i', function($match) {
return "RE[".$match[2];
}, $tempSubject);
$tempSubject = preg_replace_callback('/^(RE: RE:(?: RE:)+)/i', function($match) {
return "RE[".substr_count($match[1], "RE:")."]:";
}, $tempSubject);
$this->subject = $tempSubject;