PHP 与模板引擎 [英] PHP vs template engine

查看:37
本文介绍了PHP 与模板引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在讨论选择 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.

推荐答案

对于模板引擎:

  1. 为最终用户定制增加了安全性.纯 PHP 中的主题可以不受限制地对用户及其安装造成伤害.因此,模板引擎可以消除这种风险,如果它是好的.
  2. 易于非程序员使用,例如图形艺术家或网页设计师.

对于普通的 php:

  1. 纯 PHP 的速度是任何基于它构建的模板引擎都无法比拟的.
  2. PHP 的全部 功能可用于输出,而不仅仅是解释或过滤的部分.
  1. The speed of pure PHP cannot be matched by any template engine built atop it.
  2. 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 与模板引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆