inc_file('$2')", $compileContent);现在 $this->inc_file('$2') 被当做字符串替换了如何用 $t"/> inc_file('$2')", $compileContent);现在 $this->inc_file('$2') 被当做字符串替换了如何用 $t">

正则替换有关问题

WBOY
Release: 2016-06-13 13:44:39
Original
922 people have browsed it

正则替换问题
$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);

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!