PHP模板语言 Twig
<p><img title="PHP模板语言 Twig" border="0" alt="PHP模板语言 Twig" src="https://simg.open-open.com/show/122fb7bdf112a4f3186bed3927c4df5f.gif" width="400" height="195" /><br /> Twig是一个灵活,快速,安全的PHP模板语言。它将模板编译成经过优化的原始PHP代码。Twig拥有一个Sandbox模型来检测不可信的模板代码。Twig由一个灵活的词法分析器和语法分析器组成,可以让开发人员定义自己的标签,过滤器并创建自己的DSL。</p> <ul> <li><strong>快速</strong>: Twig <em>compiles</em> templates down to plain optimized PHP code. The overhead compared to regular PHP code was reduced to the very minimum. </li> <li><strong>安全</strong>: Twig has a <em>sandbox</em> mode to evaluate untrusted template code. This allows Twig to be used as a template language for applications where users may modify the template design. </li> <li><strong>灵活</strong>: Twig is powered by a flexible <em>lexer</em> and <em>parser</em>. This allows the developer to define its own custom tags and filters, and create its own DSL. </li> </ul> <p></p> <p>示例模板:</p> <p>{% extends "layout.html" %}<br /> <br /> {% block content %}<br /> Content of the page...<br /> {% endblock %}</p> <br /> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1322983785765" target="_blank">http://www.open-open.com/lib/view/home/1322983785765</a></p>
本文由用户 openkk 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!