PHP code example of larva / think-settings

1. Go to this page and download the library: Download larva/think-settings 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/ */

    

larva / think-settings example snippets


\larva\settings\facade\Settings::has('abv');//判断是否存在

\larva\settings\facade\Settings::get('abv');//获取
\larva\settings\facade\settings::set('abv','123456');//设置
\larva\settings\facade\settings::set('abv','1','bool');//设置 bool 类型

\larva\settings\facade\settings::set('aliyun.appid','123456');//设置配置组
\larva\settings\facade\Settings::get('aliyun.appid');//获取配置组里的

\larva\settings\facade\settings::section('aliyun');//直接获取一个配置组

以上两个方法的结果也可以使用 `settings(string $key = '', string $default = null)` 获取同样的结果
直接使用 `settings()` 空参数也可以获取到 `\larva\settings\facade\settings` 的实例;