PHP vs模板引擎 [英] PHP vs template engine
问题描述
我目前正在讨论在PHP作为模板引擎与PHP之上的模板引擎之间进行选择的问题.
I'm currently having a discussion about the choice between PHP as a template engine versus a template engine on top of PHP.
您的选择是什么,为什么?
What is your choice, and why?
我说当PHP是模板引擎本身时为什么要使用另一个模板引擎.
I say why use another template engine when PHP is a template engine itself.
推荐答案
对于模板引擎:
- 为最终用户自定义添加了安全性.纯PHP中的主题具有不受限制的能力,可对用户及其安装造成伤害.因此,模板引擎可以消除这种风险(如果是好的话).
- 便于非编程人员使用,例如图形艺术家或网页设计师.
对于纯PHP:
- 纯PHP的速度无法与其之上构建的任何模板引擎相提并论.
- PHP的 full 功能可用于输出,而不仅仅是解释或过滤的部分.
- The speed of pure PHP cannot be matched by any template engine built atop it.
- The full power of PHP is available to the output, and not just an interpreted or filtered portion.
如果可能的话,我更喜欢PHP本身.而且大多数人都不想通过创建自定义主题来入侵您的软件,因此轻松进行粗略的阅读并研究其安全性很容易.也就是说,我是同时从事模板和编程甚至是图形艺术的中间人".我的技能与严格的程序员和严格的美术师/设计师不同.
I prefer PHP itself if at all possible. And most folks don't want to hack your software by making a custom theme, so it's easy to take a cursory read and investigate its security. That said, I am the "between guy" who does both templating and programming, and even some graphic arts; my skillset differs from a strict programmer and a strict artist/designer.
这篇关于PHP vs模板引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!