PHP code example of gongzhiyang / config

1. Go to this page and download the library: Download gongzhiyang/config library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gongzhiyang / config example snippets


$confs = (new config\\Config())->get('stores.file.type');

  //目录配置文件路径

 define('CONFIG_PATH',__DIR__.'/config/');
 $conf = (new config\Config())->load(CONFIG_PATH,'cache');

 (new config\Config())->set(['name1' => 'value1', 'name2' => 'value2'], 'default');

 $confs = (new config\\Config())->get('default');
if((new config\Config())->has('defaults')) {

echo"true";

}

/**

     * 设置配置参数

     * Config::set(\['name1' => 'value1', 'name2' => 'value2'\], 'config');

     * @paramarray $config 配置参数

     * @paramstring $name 配置名称

     * @returnarray

     */