Tool.php 456 B

123456789101112131415161718192021
  1. <?php namespace Upload\Lib;
  2. use Dever;
  3. class Tool
  4. {
  5. private $config = [
  6. 1 => 'Local',
  7. 2 => 'Qiniu',
  8. 3 => 'Oss',
  9. ];
  10. public function get($config)
  11. {
  12. $save = $this->config[$config['type']] ?? false;
  13. if (!$save) {
  14. Dever::error('存储位置错误');
  15. }
  16. $tool = 'Upload\\Lib\\Tool\\' . $save;
  17. $tool = new $tool($config);
  18. return $tool;
  19. }
  20. }