preg_replace_callback出现内存泄露。有人解决了么? 最新 php5.4 是 php5.4.22尝试回调函数不使用闭包形式如果依然不能解决问题,可去 php 的 bug 网站提交 bug 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 很多人提交 这个bug了,我去看过了。 如果是:先 preg_match_all再 preg_replace也会出问题吗? 怎么实现的?原框架错误代码如下:注意【preg_replace_callback】的使用 if (! $closeTag) { $patterns = '/' . $begin . $parseTag . $n1 . '\/(\s*?)' . $end . '/is'; $content = preg_replace_callback($patterns, function ( $matches ) use( $tLib , $tag , $that ) { return $that->parseXmlTag($tLib, $tag, $matches[1], $matches[2]); }, $content); } else { $patterns = '/' . $begin . $parseTag . $n1 . $end . '(.*?)' . $begin . '\/' . $parseTag . '(\s*?)' . $end . '/is'; for ($i = 0; $i < $level; $i ++) { $content = preg_replace_callback($patterns, function ( $matches ) use( $tLib , $tag , $that ) { return $that->parseXmlTag($tLib, $tag, $matches[1], $matches[2]); }, $content); } } 既然 preg_replace_callback 会有内存泄露那么应该在任何文件中都是这样的你可以单独用一个文件测试一下$content = preg_replace_callback('/[a-z]/', function ( $matches ) { return strtoupper($matches[0]); }, 'abdfrew');echo $content;与之等价的分立代码为$content = 'abdfrew';preg_match_all('/[a-z]/', $content, $matches );foreach($matches[0] as $v) $r[$v] = strtoupper($v);$content = strtr($content, $r);echo $content;先分别运行一下,看有无问题 我的学习历程 mysql问题 不显示删除回复显示所有回复显示星级回复显示得分回复 大家谁对织梦网系统熟悉? 我的出现问题了! 请大哥大姐们帮下 如何配置伪静态 Uploadify 在windows上运行正常,迁移到linux系统上firefox运行错误(高分赠送) php中文路径问题 求大神指教这怎么解码urldecode 求源代码 求数据库大神,指导存储过程批量更新 公司文件管理平台,用什么CMS合适 ajax提交 获取头部token的问题 我自己的服务器,网站 可以访问了,怎么设置好FTP 怎样把网站页面生成长微博
先 preg_match_all
再 preg_replace
也会出问题吗?
原框架错误代码如下:注意【preg_replace_callback】的使用
if (! $closeTag)
{
$patterns = '/' . $begin . $parseTag . $n1 . '\/(\s*?)' . $end . '/is';
$content = preg_replace_callback($patterns, function ( $matches ) use( $tLib , $tag , $that )
{
return $that->parseXmlTag($tLib, $tag, $matches[1], $matches[2]);
}, $content);
} else
{
$patterns = '/' . $begin . $parseTag . $n1 . $end . '(.*?)' . $begin . '\/' . $parseTag . '(\s*?)' . $end . '/is';
for ($i = 0; $i < $level; $i ++)
{
$content = preg_replace_callback($patterns, function ( $matches ) use( $tLib , $tag , $that )
{
return $that->parseXmlTag($tLib, $tag, $matches[1], $matches[2]);
}, $content);
}
}
那么应该在任何文件中都是这样的你可以单独用一个文件测试一下
$content = preg_replace_callback('/[a-z]/', function ( $matches ) {
return strtoupper($matches[0]);
}, 'abdfrew');
echo $content;与之等价的分立代码为
$content = 'abdfrew';
preg_match_all('/[a-z]/', $content, $matches );
foreach($matches[0] as $v) $r[$v] = strtoupper($v);
$content = strtr($content, $r);
echo $content;
先分别运行一下,看有无问题