Tool.php 480 B

12345678910111213141516171819202122
  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();
  18. $tool->init($config);
  19. return $tool;
  20. }
  21. }