function __construct($config) { if (empty($config['base_dir']) or empty($config['base_url'])) { throw new \Exception(__CLASS__ . ' require base_dir and base_url.'); } $this->base_dir = $config['base_dir']; if (Tool::endchar($this->base_dir) != '/') { $this->base_dir .= '/'; } $this->base_url = $config['base_url']; $mime = new Swoole\MimeType(); $this->mimes = array_flip($mime->getAll()); }
function __construct($config) { if (empty($config['base_dir']) or empty($config['base_url'])) { throw new \Exception(__CLASS__ . ' require base_dir and base_url.'); } $this->base_dir = $config['base_dir']; if (Tool::endchar($this->base_dir) != '/') { $this->base_dir .= '/'; } $this->base_url = $config['base_url']; $mimes = (require LIBPATH . '/data/mimes.php'); $this->mimes = $mimes; }