final Class Config implements \ArrayAccess { public $config = []; private $path = null;
public function __construct() { $this->path = __DIR__ . '/../../../shihuo_v36/config/'; } public function offsetExists($offset) { return isset($this->config[$offset]); } public function offsetGet($offset) { if (!isset($this->config[$offset])) { $ymlPath = $this->path . $offset . '.yml';
$data = spyc_load_file($ymlPath);
$this->config[$offset] = $data; } return $this->config[$offset]; } public function offsetSet($offset, $value) { $this->config[$offset] = $value; } public function offsetUnset($offset) { } }