Asf_Config_Ini 读取ini配置文件
$section 参数只在加载INI文件时有效
如果设置ini配置项 asf.cache_config_enable=1, 配置内容会常驻内存
在开启命名空间情况下(asf.use_namespace=1)类名为 Asf\Config\Ini
<?php final class Asf_Config_Ini extends Asf_Config_AbstractConfig { public function __construct(string $file_path [, string $section = '']) }
[MySQL]
host = 127.0.0.2
port = 3306
password = 123456
[Redis]
host = 127.0.0.1
port = 6379
password = 123456,
timeout = 1
persistent = 0
other[pass] = 654321
默认返回的数据是对象, 需要使用函数toArray()转换成数组
<?php
$config = new Asf_Config_Ini("/path/conf.ini");
print_r($config->toArray());
<?php
$config = new Asf_Config_Ini("/path/conf.ini", "MySQL");
print_r($config->toArray());