我应该如何命名我的PHP类文件? [英] What should I name my PHP class file?
本文介绍了我应该如何命名我的PHP类文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经看到许多不同的命名方案和扩展用于PHP文件,基本上只是类。一些示例:
I have seen many different naming schemes and extensions used for PHP files that are basically just classes. Some examples:
- myClass.php
- myClass.class.php
- myClass.class
有什么区别,哪个更好?
What is the difference, and which is better?
推荐答案
除了你看到的,没有什么区别。如果您使用 .class rel =nofollow noreferrer> autoloading ,并且没有类文件所在的特定目录。否则,它是完全任意的。 (我以前使用 ClassName.class.php
。)
There is no difference beyond what you see. The ones with .class
are helpful if you use autoloading and don't have a specific directory where your class files live. Otherwise, it's entirely arbitrary. (I used to use ClassName.class.php
.)
这篇关于我应该如何命名我的PHP类文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文