命名php文件

前端之家收集整理的这篇文章主要介绍了命名php文件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

是否有任何命名PHP文件的约定?
不是在谈论PHP文件,而是大多数HTML文件,其中包含一些PHP.
应该是my-file-example.PHP还是myFileExample.PHP或myfileexample.PHP

最佳答案
PHP中没有明确的命名约定,它们可能因框架而异.如果你不使用任何框架,你可以使用一个流行的:

> with_underscores
> PascalCased
> camelCased

这个表很有用,并告诉你更多关于命名约定的信息(不仅是文件,还有类,方法函数名称):

╔═══════════════════════╦═════════════╦════════════╦══════════════╦════════════╦════════════╗
║      PHP Project      ║   Classes   ║  Methods   ║  Properties  ║ Functions  ║ Variables  ║
╠═══════════════════════╬═════════════╬════════════╬══════════════╬════════════╬════════════╣
║ Akelos Framework      ║ PascalCase  ║ camelCase  ║ camelCase    ║ lower_case ║ lower_case ║
║ CakePHP Framework     ║ PascalCase  ║ camelCase  ║ camelCase    ║ camelCase  ║ camelCase  ║
║ CodeIgniter Framework ║ Proper_Case ║ lower_case ║ lower_case   ║ lower_case ║ lower_case ║
║ Concrete5 CMS         ║ PascalCase  ║ camelCase  ║ camelCase    ║ lower_case ║ lower_case ║
║ Doctrine ORM          ║ PascalCase  ║ camelCase  ║ camelCase    ║ camelCase  ║ camelCase  ║
║ Drupal CMS            ║ PascalCase  ║ camelCase  ║ camelCase    ║ lower_case ║ lower_case ║
║ Joomla CMS            ║ PascalCase  ║ camelCase  ║ camelCase    ║ camelCase  ║ camelCase  ║
║ modx CMS              ║ PascalCase  ║ camelCase  ║ camelCase    ║ camelCase  ║ lower_case ║
║ Pear Framework        ║ PascalCase  ║ camelCase  ║ camelCase    ║            ║            ║
║ Prado Framework       ║ PascalCase  ║ camelCase  ║ Pascal/camel ║            ║ lower_case ║
║ SimplePie RSS         ║ PascalCase  ║ lower_case ║ lower_case   ║ lower_case ║ lower_case ║
║ Symfony Framework     ║ PascalCase  ║ camelCase  ║ camelCase    ║ camelCase  ║ camelCase  ║
║ wordpress CMS         ║             ║            ║              ║ lower_case ║ lower_case ║
║ Zend Framework        ║ PascalCase  ║ camelCase  ║ camelCase    ║ camelCase  ║ camelCase  ║
╚═══════════════════════╩═════════════╩════════════╩══════════════╩════════════╩════════════╝

请记住与命名约定保持一致.

原文链接:https://www.f2er.com/html/426275.html

猜你在找的HTML相关文章