<code> 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; } </code>
<code> 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; } </code>