ThinkPHP5 配置文件

配置目录

系统默认的配置文件目录就是应用目录(APP_PATH),也就是默认的application下面,并分为应用配置(整个应用有效)和模块配置(仅针对该模块有效)。

├─application         应用目录
│  ├─config.php       应用配置文件
│  ├─database.php     数据库配置文件
│  ├─route.php        路由配置文件
│  ├─index            index模块配置文件目录
│  │  ├─config.php    index模块配置文件
│  │  └─database.php index模块数据库配置文件


如果不希望配置文件放到应用目录下面,可以在入口文件中定义独立的配置目录,添加CONF_PATH常量定义即可,例如:
// 定义配置文件目录和应用目录同级
define('CONF_PATH', __DIR__.'/../config/');
├─application         应用目录
├─config              配置目录
│  ├─config.php       应用配置文件
│  ├─database.php     数据库配置文件
│  ├─route.php        路由配置文件
│  ├─index            index模块配置文件目录
│  │  ├─config.php    index模块配置文件
│  │  └─database.php index模块数据库配置文件


如果想要修改默认输出类型 default_return_type,可以到 application/config.php 中修改,即在应用配置文件中修改。

猜你喜欢

转载自www.cnblogs.com/ryanzheng/p/10024334.html