顺晟科技
2021-06-16 10:44:27
329
1、服务器的服务器端编程语言(专业超文本预处理器的缩写)版本必须=5.5 版本,我这里使用的是PHP 7.0版本;
2、下载php-sdk压缩版本,我这里下载的是php-sdk-3.3.0.zip版本;
3、把压缩包解压缩到织梦模板织梦的包括目录下,如下图所示:
我这里把压缩包重命名为upyun-php-sdk了
4、打开\ include \ dialog \ select _ images _ post。服务器端编程语言(Professional Hypertext Preprocessor的缩写)文件,做如下修改:
$fullfilename=$cfg_basedir .$activepath .'/'.$ filename
修改为:
$fullfilename=$activepath .'/'.$ filename
或者
$ full filename='/。MD5($ _ SERVER[' HTTP _ HOST ']).$activepath ./'.$ filename
然后,在该语句下面增加如下语句块:
/*
* $ filename _ name : 1-1ZF215300B29.jpg
* $ filename : 190702/1-1ZF 2152 u 3440。使用jpeg文件交换格式存储的编码图像文件扩展名
* $ active path :/uploads/allig
*/
# 上传图片到又拍云存储开始
require _ once DEDEINC ./upyun-PHP-SDK/厂商/自动加载。PHP ';
使用Upyun \ Upyun
使用Upyun \配置
$serviceConfig=新配置('服务名称', '操作员账号', '操作员密码');
$ ServiceConfig-UploadType=' AUTO ';
$ client=new Upyun($ ServiceConfig);
$ local _ file _ path=
$ remote _ file _ path='/。MD5($ _ SERVER[' HTTP _ HOST ']).$activepath ./'.$ filename
$file=fopen($imgfile,' r ');
$ client-write($ remote _ file _ path,$ file);
print _ r($ client);
# 上传图片到又拍云存储结束
然后把如下语句块注释掉:
move_uploaded_file($imgfile,$fullfilename)或' die('上传文件到$完整文件名失败!');
if($ CFG _ remote _ site==' Y ' $ remote uploads==1)
{
//分析远程文件路径
$ remote file=str _ replace(DEDEROOT,",$ full filename);
$localfile='./.'。$ remotefile
//创建远程文件夹
$ remote dir=preg_replace('/[^\/]*\.(jpg|gif|bmp|png)/','',$ remote file);
$ FTP-rmkdir($ remote dir);
$ftp-upload($localfile,$ remote file);
}
这样就完成了整个过程了。
11
2022-08
16
2022-03
16
2021-06
16
2021-06
16
2021-06
16
2021-06