1.打开 e/class/connect.php 找到 if(!defined('EmpireCMSConfig')) { exit(); } 在下面增加 //阿里云上传 require_once(ECMS_PATH.'e/xinglian/aliyunoss/autoload.php'); use OSS\OssClient; use OSS\Core\OssException; function aliup($filename,$img){ global $accessKeyId,$accessKeySecret,$endpoint,$bucket; $object = $filename; $content = $img; $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint); $content = $ossClient->putObject($bucket, $object, $content); return ""; } //阿里云上传结束 继续找到 function DoTranFile($file,$file_name,$file_type,$file_size,$classid,$ecms=0){ 找到 global $public_r,$class_r,$doetran,$efileftp_fr; 替换为 global $public_r,$class_r,$doetran,$efileftp_fr,$ossoff,$endpoint,$bucket,$alihttp; 继续在下面找到 //FileServer if($public_r['openfileserver']) { $efileftp_fr[]=$r['yname']; } return $r; 在上面增加 //开始存储到阿里云oss if($ossoff==1){ $uri = $r["url"]; if (file_exists($_SERVER["DOCUMENT_ROOT"].$uri)) { $string=ReadFiletext($_SERVER["DOCUMENT_ROOT"].$uri); $alfile=$fspath['filepath'].$filepath.$r[filename]; aliup($alfile,$string); if($alihttp){ $r[url]=$alihttp.$r[url]; } else { $r[url]="http://".$bucket.".".$endpoint.$r[url]; } } } 然后继续查找 //远程保存 function DoTranUrl($url,$classid){ 把下面一行的 global $public_r,$class_r,$ecms_config,$efileftp_fr; 替换为 global $public_r,$class_r,$ecms_config,$efileftp_fr,$ossoff,$endpoint,$bucket,$alihttp; 继续找到 $r[yname]=$r[savepath].$r[filename]; 在下面增加 if($ossoff==1){ $alfile=$fspath['filepath'].$filepath.$r[filename]; aliup($alfile,$string); if($alihttp){ $r[url]=$alihttp.$r[url]; } else { $r[url]="http://".$bucket.".".$endpoint.$r[url]; } } 然后找到 WriteFiletext_n($r[yname],$string); 修改为 if($ossoff==0){WriteFiletext_n($r[yname],$string)}; 2.打开/e/admin/ecmseditor/fileinc/editorpic.php 找到 if(!defined('InEmpireCMS')) { exit(); } 在下面加 require_once(ECMS_PATH.'e/xinglian/aliyunoss/config.php'); 继续找到 $file=$fspath['fileurl'].$filepath.$r[filename]; 修改为 if($ossoff==1){ if($alihttp){ $file=$alihttp.$fspath['fileurl'].$filepath.$r[filename]; } else { $file="http://".$bucket.".".$endpoint.$fspath['fileurl'].$filepath.$r[filename]; } }else{ $file=$fspath['fileurl'].$filepath.$r[filename]; } 3.继续打开 e/class/functions.php 在