https://github.com/zhan3333/config
https://github.com/zhan3333/config
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/zhan3333/config
- Owner: zhan3333
- Created: 2017-05-31T09:58:55.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-01T03:02:42.000Z (about 9 years ago)
- Last Synced: 2025-02-16T09:17:00.625Z (over 1 year ago)
- Language: PHP
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 功能
- 加载php配置文件
- 加载php配置文件夹
- 批量加载php配置文件
# 示例
```
require 'vendor/autoload.php';
use LoadConfig\Config;
// 加载文件夹
$path = '/rootpath/config';
$config = new Config($path);
// 加载单个文件
$path = '/path/to/config/databases.php';
$config = new Config($path);
// 加载多个文件
$paths = [
'/rootpath/config',
'/path/to/config/databases.php',
];
$config = new Config($paths);
// 取值
$host = $config->get('databases.mysql.host');
$host = $config['databses.mysql.host'];
```