Asf_Config_Simple


Introduction

Asf_Config_Simple PHP变量配置项

在此模式下, 设置ini配置项 asf.cache_config_enable=1, 不会缓存内容

在开启命名空间情况下(asf.use_namespace=1)类名为 Asf\Config\Simple

Class synopsis

<?php
final class Asf_Config_Simple extends Asf_Config_AbstractConfig
{
    public function __construct(array $values)
}

Examples

Example #1 获取配置

<?php
$config_default = array(
    'asf' => array(
        'root_path'  => __DIR__,
        'dispatcher' => array(
            'throw_exception' => 0
        ),
    )
);

$conf = new Asf_Config_Simple($config_default);
print_r($conf->toArray());
print_r($conf->asf->root_path); // /tmp/www/

Example #2

<?php
$config_default = array(
    'asf' => array(
        'root_path'  => __DIR__,
        'dispatcher' => array(
            'throw_exception' => 0
        ),
    )
    'db' => array(
        'user' => 'root', 'pass' => '', 'host' => '127.0.0.1'
    )
);

$conf = new Asf_Config_Simple($config_default);
print_r($conf->db->toArray());

/*
Array
(
    [user] => root
    [pass] => 
    [host] => 127.0.0.1
)
*/