我是否正确理解了Codeigniter目录结构?

时间:2012-09-17 13:23:07

标签: codeigniter

这就是我理解Codeigniter目录结构的操作方式。我正在使用Codeigniter 2.1.2。我误解了每个目录的用途吗?我忘记了什么?

-+ /application/
 |
 |-+ /cache/        Used for caching pages if it is enabled
 |-+ /config/       Contains the configuration files for this project
 |-+ /controllers/  All of your controllers are saved here
 |-+ /core/         Used for modifying the core Codeigniter classes
 |-+ /errors/       Handles your errors and their output
 |-+ /helpers/      Contains your own functions
 |-+ /hooks/        Used for running code at the certain points in the routing process
 |-+ /language/     Occasionally used for translating parts of your project into different languages
 |-+ /libraries/    Contains your own classes
 |-+ /logs/         When you log any sort of notice it is saved inside a file in here
 |-+ /models/       All of your models are saved here
 |-+ /third_party/  Basically another name for plugins which go here
 |-+ /views/        Your views are saved here normally organised by controller inside a new directory

-+ system/          Never go in here instead use the core directory inside /application/

-+ index.php        The front controller for your project

谢谢!

1 个答案:

答案 0 :(得分:5)

几乎,您对目录结构的基本了解是正确的。也就是说,您应该避免修改核心CodeIgniter类,而应该根据需要扩展它们。

助手不仅仅是'包含你自己的功能'。帮助程序既可以是您的函数,也可以是内置函数,但这些是核心MVC集之外的类/函数,可以“帮助”完成某些事情,例如形成建筑或其他日常任务。