ThinkPHP/Library/Think/Upload/Driver/Sae.class.php

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: luofei614<weibo.com/luofei614>
// +----------------------------------------------------------------------

namespace Think\Upload\Driver;
class Sae{
    /**
     * Storage的Domain
     * @var string
     */
    private $domain     =   '';

    private $rootPath   =   '';

    /**
     * 本地上传错误信息
     * @var string
     */
    private $error      =   ''; 

    /**
     * 构造函数,设置storage的domain, 如果有传配置,则domain为配置项,如果没有传domain为第一个路径的目录名称。 
     * @param mixed $config 上传配置     
     */
    public function __construct($config = null){
        if(is_array($config) && !empty($config['domain'])){
            $this->domain   =   strtolower($config['domain']);
        }
    }

    /**
     * 检测上传根目录
     * @param string $rootpath   根目录
     * @return boolean true-检测通过,false-检测失败
     */
    public function checkRootPath($rootpath){
        $rootpath = trim($rootpath,'./');
        if(!$this->domain){
            $rootpath = explode('/', $rootpath);
            $this->domain = strtolower(array_shift($rootpath));
            $rootpath = implode('/', $rootpath);
        }

        $this->rootPath =  $rootpath;
        $st =   new \SaeStorage();
        if(false===$st->getDomainCapacity($this->domain)){
          $this->error  =   '您好像没有建立Storage的domain['.$this->domain.']';
          return false;
        }
        return true;
    }

    /**
后面还有 46 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。