PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

preg_replace换成preg_replace_callback解决方法

原创
2016-06-13 12:26:25 787浏览

preg_replace换成preg_replace_callback
 function fetch_str($source){
        $source = $this->smarty_prefilter_preCompile($source);
        return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
  }
------解决思路----------------------

return preg_replace_callback("/{([^\}\{\n]*)}/", 
function($m) {
return $this->select($m[1]);
}, $source);

分行写只是为了看得清楚

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。