首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

正则替换有关问题

2012-03-21 
正则替换问题$compileContent preg_replace(/(\{cm:)include\s*(.+)(\})/i, \$this-inc_file($2)

正则替换问题
$compileContent = preg_replace("/(\{cm:)include\s*(.+)(\})/i", "\$this->inc_file('$2')", $compileContent);

现在 $this->inc_file('$2') 被当做字符串替换了

如何用 $this->inc_file('$2') 返回的结果替换呢

[解决办法]
$compileContent = preg_replace("/(\{cm:)include\s*(.+)(\})/ie", "\$this->inc_file('$2')", $compileContent);

热点排行