setConfig($config); if ($this->type == 'sts') { $this->client = $this->initVodSTSClient($securityToken); } else { $this->client = $this->initVodClient(); } } /** * User: ZeMing Shao * Email: szm19920426@gmail.com * @return DefaultAcsClient */ public function initVodClient() { $profile = DefaultProfile::getProfile($this->regionId, $this->accessKeyID, $this->accessKeySecret); return new DefaultAcsClient($profile); } /** * User: ZeMing Shao * Email: szm19920426@gmail.com * @param $securityToken * @return DefaultAcsClient */ public function initVodSTSClient($securityToken) { $profile = DefaultProfile::getProfile($this->regionId, $this->accessKeyID, $this->accessKeySecret, $securityToken); return new DefaultAcsClient($profile); } /** * User: ZeMing Shao * Email: szm19920426@gmail.com * @param $config */ public function setConfig($config) { if($config){ $this->config = $config; }else{ $this->config = \app\common\model\config\System::getConfig('alivod'); } $this->accessKeyID = $this->config['access_key_id']; $this->accessKeySecret = $this->config['access_key_secret']; $this->regionId = $this->config['region_id']; $this->timeout = '3600'; // 如果是获取签名有效时间为多少 $this->type = 'access';//类型:access|sts 如果是sts 实例化对象时候需要传入$securityToken $this->acceptFormat = 'JSON';//返回数据格式 } }