更新时间:2023-12-03 18:51:04
这是我的设置。对于小型非常大型的项目(包括社交网络),这对我来说非常棒。
这些文件夹都将存在于我的主要应用程序文件夹中:
所有目录显然都可以包含进一步组织文件的子文件夹。例如,'css'文件夹可以具有名为web和mobile的子文件夹。 'images'文件夹可以包含'user_uploaded'文件夹,然后可以包含''profile'。当然,您可以根据需要添加文件夹,在一个项目中,我有一个名为上传者的文件夹,它只包含独立的上传脚本。
我还使用方便的方法来帮助构建我要加载的文件名。例如,我的loadView()将在当前模块目录中查找视图文件,或者如果传递了一个可选的$ module参数,那么它将特别在该模块的文件夹中。
我希望这有帮助。
I am creating a very large PHP MVC-based site that will have a large library of php classes, javascripts, and many css files (not to mention a large amount of files for the MVC).
For the first time ever, I am actually taking the time to plan out a clean and organized directory structure.
What directory structures do you typically use, and which will be easiest to manuever when there are thousands of files?
This is my setup. It's worked great for me for small - very large projects (including a social network).
These folders would all live within my main application folder:
All the directories could obviously contain sub-folders that would further organize your files. For example, the 'css' folder could have sub-folders named 'web' and 'mobile'. The 'images' folder could contain a 'user_uploaded' folder which could then contain`'profile'. And of course you can add folders as you see fit, in one project I have a folder called 'uploaders' which just contains stand-alone upload scripts.
I also use convenience methods which help construct the filenames of what I want to load. For example, my loadView() will look for the view file in the current module directory, or if you pass an optional $module argument, it will look specifically within that module's folder.
I hope this helps.