function uploadopenossserver($filer,$ossid=1,$type=0){ global $empire,$dbtbpre,$public_r,$ftp_r,$oss_r,$incftp; $pr=getossserverinfo($ossid); @include(ecms_path.e/extend/aliyun/oss/sdk.class.php); if(!$pr[hostname]){ if($pr[osstype]=='1') { $pr[hostname]='oss-cn-hangzhou.aliyuncs.com'; } elseif($pr[osstype]=='2'){ $pr[hostname]='oss-cn-hangzhou-internal.aliyuncs.com'; } elseif($pr[osstype]=='3'){ $pr[hostname]='oss-cn-qingdao.aliyuncs.com'; } elseif($pr[osstype]=='4'){ $pr[hostname]='oss-cn-qingdao-internal.aliyuncs.com'; } elseif($pr[osstype]=='5'){ $pr[hostname]='oss-cn-beijing.aliyuncs.com'; } elseif($pr[osstype]=='6'){ $pr[hostname]='oss-cn-beijing-internal.aliyuncs.com'; } elseif($pr[osstype]=='7'){ $pr[hostname]='oss-cn-hongkong.aliyuncs.com'; } elseif($pr[osstype]=='8'){ $pr[hostname]='oss-cn-hongkong-internal.aliyuncs.com'; } elseif($pr[osstype]=='9'){ $pr[hostname]='oss-cn-shenzhen.aliyuncs.com'; } else{ $pr[hostname]='oss-cn-hangzhou-internal.aliyuncs.com'; } } else{ printerror2(oss节点选择错误,无法同步); } $oss=new alioss($pr[access_key_id],$pr[access_key_secret],$pr[hostname]); $oss->set_debug_mode(false); foreach ($filer as $file){ $object=str_replace(ecms_path,'',$file); //$truefile=rtruepathopen($pr[bucket],$filenopath); $oss->upload_file_by_file($pr[bucket],$object,$file); //上传文件 print_r($oss); } //退出oss $oss=null; return true; }
回复内容: function uploadopenossserver($filer,$ossid=1,$type=0){ global $empire,$dbtbpre,$public_r,$ftp_r,$oss_r,$incftp; $pr=getossserverinfo($ossid); @include(ecms_path.e/extend/aliyun/oss/sdk.class.php); if(!$pr[hostname]){ if($pr[osstype]=='1') { $pr[hostname]='oss-cn-hangzhou.aliyuncs.com'; } elseif($pr[osstype]=='2'){ $pr[hostname]='oss-cn-hangzhou-internal.aliyuncs.com'; } elseif($pr[osstype]=='3'){ $pr[hostname]='oss-cn-qingdao.aliyuncs.com'; } elseif($pr[osstype]=='4'){ $pr[hostname]='oss-cn-qingdao-internal.aliyuncs.com'; } elseif($pr[osstype]=='5'){ $pr[hostname]='oss-cn-beijing.aliyuncs.com'; } elseif($pr[osstype]=='6'){ $pr[hostname]='oss-cn-beijing-internal.aliyuncs.com'; } elseif($pr[osstype]=='7'){ $pr[hostname]='oss-cn-hongkong.aliyuncs.com'; } elseif($pr[osstype]=='8'){ $pr[hostname]='oss-cn-hongkong-internal.aliyuncs.com'; } elseif($pr[osstype]=='9'){ $pr[hostname]='oss-cn-shenzhen.aliyuncs.com'; } else{ $pr[hostname]='oss-cn-hangzhou-internal.aliyuncs.com'; } } else{ printerror2(oss节点选择错误,无法同步); } $oss=new alioss($pr[access_key_id],$pr[access_key_secret],$pr[hostname]); $oss->set_debug_mode(false); foreach ($filer as $file){ $object=str_replace(ecms_path,'',$file); //$truefile=rtruepathopen($pr[bucket],$filenopath); $oss->upload_file_by_file($pr[bucket],$object,$file); //上传文件 print_r($oss); } //退出oss $oss=null; return true; }