Storage.class.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * 洛阳赤炎鹰网络科技有限公司
  4. * https://www.cyyvip.com
  5. * Copyright (c) 2022 赤店商城 All rights reserved.
  6. */
  7. // +----------------------------------------------------------------------
  8. // | TOPThink [ WE CAN DO IT JUST THINK ]
  9. // +----------------------------------------------------------------------
  10. // | Copyright (c) 2013 http://topthink.com All rights reserved.
  11. // +----------------------------------------------------------------------
  12. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  13. // +----------------------------------------------------------------------
  14. // | Author: liu21st <liu21st@gmail.com>
  15. // +----------------------------------------------------------------------
  16. namespace Think;
  17. // 分布式文件存储类
  18. class Storage {
  19. /**
  20. * 操作句柄
  21. * @var string
  22. * @access protected
  23. */
  24. static protected $handler ;
  25. /**
  26. * 连接分布式文件系统
  27. * @access public
  28. * @param string $type 文件类型
  29. * @param array $options 配置数组
  30. * @return void
  31. */
  32. static public function connect($type='File',$options=array()) {
  33. $class = 'Think\\Storage\\Driver\\'.ucwords($type);
  34. self::$handler = new $class($options);
  35. }
  36. static public function __callstatic($method,$args){
  37. //调用缓存驱动的方法
  38. if(method_exists(self::$handler, $method)){
  39. return call_user_func_array(array(self::$handler,$method), $args);
  40. }
  41. }
  42. }