ThinkPHP 目录结构

2.0 ThinkPHP 目录结构


在前面的博客中,通过一个简单的案例向大家演示了在ThinkPHP 框架下开发的大致法程,本篇博客将对ThinkPHP框架目录结构进行详细讲解。

要想在项目中熟练地使用ThinkFPHP框架.首先需要了解ThankPHP框架的目录结构


表2-1 ThinkPHP框架目录结构

表2-1 ThinkPHP框架目录结构
文件路径 文件描述
\index.php 入口文件
\Application 应用目录
\Public 资源文件目录
\ThinkPHP 框架核心目录

 

表2-2 ThinkPHP应用目录结构

表2-2 ThinkPHP应用目录结构
文件路径 文件描述
\Application\Common  应用公共模块 
\Application\Common\Common  应用公共函数目录,为Application目录下的所有模块提供公共函数
\Application\Common\Conf  应用公共配置文件目录,为Application目录下的所有模块提供公共配置
\Application\Home  ThinkPHP框架默认生成Home模块
\Application\Home\Conf  模块配置文件目录,为Home模块提供配置信息
\Application\Home\Common  模块函数公共目录,为Home模块提供公共函数
\Application\Home\Controller  模块控制器目录
\Application\Home\Model  模块模型目录
\Application\Home\View  模块视图目录
\Application\Runtime  运行时目录
\Application\Runtime\Cache  模板缓存目录
\Application\Runtime\Date  数据目录
\Application\Runtime\Logs  日志目录
\Application\Runtime\Temp  缓存目录

ThinkPHP架构的核心文件都在\ThinkPHP下,框架核心目录ThinkPHP的结构如表2-3所示

表2-3 框架核心目录结构

表2-3 框架核心目录结构
文件路径 文件描述
\ThinkPHP\Common 核心公共函数目录
\ThinkPHP\Conf 核心配置目录
\ThinkPHP\Lang 核心语言包目录
\ThinkPHP\Library 核心类库目录
\ThinkPHP\Library\Think 核心ThinkPHP目录
\ThinkPHP\Library\Behavior 行为类库目录
\ThinkPHP\Library\Org Org类库包目录
\ThinkPHP\Library\Vendor 第三方类库目录
\ThinkPHP\Mode 框架应用模式目录
\ThinkPHP\Tpl 系统模板目录
\ThinkPHP\ThinkPHP.php ThinkPHP框架入口文件

表2-3中,\ThinkPHP\Conf目录是ThnkPHP的核心配置目录,其中包含了ThinkPHP惯例配置文件,数据库连接信息、ThinkPHP默认设定URL 访问模式等默认配置都在这个惯例配置文件中。

\ThnkPHP\Library\Think是核心ThinkPHP类库包目录,其中包含了App.class.pbp(应用程序类)、Controller.php(控制器基类). Model.class.php(模型类 )View.class.php( 视图类)等ThinkPHP运行所需的基础类文件。

\ThinkPHP\Library\Vendor是第三方类库目录,其中包含了许多第三方提供的功能类文件。如Smarty模板引擎。

需要注意的是,一般不建议直接修改\ThinkPHP\Conf目录下的配置文件,如果想要修改某些配置,将配置信息放到指定目录下的config.php文件中,具体配置方法下篇博客讲解。

猜你喜欢

转载自www.cnblogs.com/lemon-Net-Skill/p/9860383.html