# Config **Repository Path**: funco/Config ## Basic Information - **Project Name**: Config - **Description**: 为PHP项目提供Config读取和更改支持。路径以英文句号'.'分割 - **Primary Language**: PHP - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2018-05-11 - **Last Updated**: 2024-06-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Config #### Description 为PHP项目提供Config读取和更改支持。 路径以英文句号'.'分割 #### Software Architecture - docs - src - Config.php - 读取配置类 - config.php - 默认读取的配置 - LICENSE - README.md #### Installation 1. git clone https://gitee.com/funco/Config.git #### Instructions 1. $config = new Config(); 2. $config->get(); 3. $config->set(, ); #### Example 假设config.php内容如下 ```php [ 'HOST' => '127.0.0.1', 'PORT' => 3306, ], 'VERSION' => '1.0', ]; ``` 则调用过程如下 ```php $config = new Config(__DIR__ . '../config.php'); echo 'mysql: ' . $config->get('MYSQL.HOST') . ':' . $config->get('MYSQL.PORT') . PHP_EOL; echo 'version: ' . $config->get('VERSION'); ``` 上述程序输出结果如下 ``` mysql: 127.0.0.1:3306 version: 1.0 ``` #### Note 1. 默认文件是Config类同目录下的config.php 2. 建议使用__DIR__获取当前文件所处绝对路径,再连接config相对当前路径的绝对目录 #### Contact 1. 码云给我账号私信 2. qq: 1136223237 3. email: linhongzhao321@hotmail.com