php 项目中的文件夹结构

folder structure in php project

我正在尝试重组我的项目,因为我所有的文件都在附近。但是文件夹结构看起来没问题,还是我做错了什么?

public_html 是 public 站点,用户未登录 user_html 我们是用户登录的私人站点

我希望我没有把它放在错误的类别中。如果我道歉,请告诉我。

文件夹结构:

查看 codeigniter 目录结构。

更好的方法是使用 php mvc 框架。

即使您不使用 Composer 自动加载 PSR-4 目录结构也非常好,如果您使用它并想在以后添加自动加载,您也可以这样做。我想大多数框架都会使用它。

我使用的大体布局是:

app_name -> general dir
|  
|____App -> where your app goes
|    |___app_name -> name of application
|    |  |___ models -> these can be whatever you want
|    |  |___controllers
|    |
|    |____templates -> where I put my php/html/twig
|    |
|    |____css -> application specific
|    |    |
|    |    |____app.css
|    |
|    |____js -> application specific
|         | 
|         |____app.js
|
|____Vendor
|    |____php -> php libs
|    |____js  -> frontend css js libs
|
|____Tests
|    |____modelTest
|
|____.git
|____composer.json 
|____bower.json
|____index.php