php - 为什么在使用 zend 框架时脚本会被赋予 .phtml 扩展名?

标签 php zend-framework

为什么在使用 zend 框架时脚本会被赋予 .phtml 扩展名?

最佳答案

据我所知,.phtml 扩展名仅适用于查看文件。

Matthew Weier O'Phinney给出了他为什么建议将 .phtml 用于 View 的原因:

I actually chose .phtml as (a) most apache configurations specify it as an alternate extension associated with the PHP engine, (b) most IDEs and text editors will identify .phtml as PHP + HTML for syntax highlighting, and (c) it visually separates template scripts from other PHP files in the directory tree.

所以这没什么大不了的;它只是更清楚地表明, View 文件主要由散布在应用程序 HTML 模板中的 PHP 组成。正如他在 (b) 点中所说,大多数 IDE 和编辑器都可以识别 .phtml 文件,因此您在处理它们时应该不会遇到麻烦。

关于php - 为什么在使用 zend 框架时脚本会被赋予 .phtml 扩展名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3053050/

相关文章:

php - 关闭编译器执行中的PHP错误

php - 对 <head> 和 <body> 脚本使用 headScript View 助手

php - Zend 框架 : How to handle exceptions in Ajax requests?

PHP 5 : What DAL are you using?

php - Doctrine (postgresql) Pessimistic Locking - 不会抛出 PessimisticLockException

php - ASP.NET 使用 HttpWebRequest 到 Wordpress SSO

php - 从关联数组中删除某些键和值

javascript - 如何使用 OOP 来避免一遍又一遍地重复相同的代码?

zend-framework - Zend 框架 1 : Different Error-Layout and -scripts for each module

php - 如何让 magento 使用与 'Default Category' 不同的类别来生成标题导航?