tp5的配置种类包含四个分类
核心框架内置的配置文件(thinkphp/convention.php),无需更改。
每个应用的全局配置文件(项目根目录下app/config目录下的文件)。
每个模块的配置文件(相同配置参数会覆盖应用配置。)比如index模块app/index/config/database.php
主要指在控制器或行为中进行(动态)更改配置。建议少用
如果你的类实现了ArrayAccess接口,那么这个类的对象就可以使用$foo[‘xxx‘]这种结构了。
$foo[‘xxx‘] 对应调用offsetGet方法。
$foo[‘xxx‘] = ‘yyy‘ 对应调用offsetSet方法。
isset($foo[‘xxx‘]) 对应调用offsetExists方法。
unset($foo[‘xxx‘]) 对应调用offsetUnset方法。
具体实现:
<?php
namespace lib;
class ArrayObj implements \ArrayAccess{
    private $arr = [
        ‘name‘ => ‘cl‘,
        ‘age‘ => ‘25‘
    ];
    public function offsetExists( $offset ) {
        return isset($this->arr[$offset]);
    }
    public function offsetGet( $offset ) {
        return $this->arr[$offset];
    }
    public function offsetSet( $offset, $value ) {
        return $this->arr[$offset] = $value;
    }
    public function offsetUnset( $offset ) {
        unset( $this->arr[$offset]);
    }
}
原文:https://www.cnblogs.com/cl94/p/12636611.html