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 node selection error, unable to sync"); } $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); Upload file Print_r ($oss); }//exit OSS $oss =null; return true; }
Reply content:
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 node selection error, unable to sync"); } $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); Upload file Print_r ($oss); }//exit OSS $oss =null; return true; }