gavinyyb

官网链接:http://kindeditor.net/demo.php

配合把图片上传到七牛云的参考:

基本思路:https://blog.csdn.net/qq_24334403/article/details/52526613

主要是在前端页面KindEditor的配置参数里指定处理图片的php页面:

uploadJson: \'/extend/upload.php\',

 改文件upload_json.php

require_once \'JSON.php\';  --原来的
require_once
\'php-sdk/autoload.php\'; use Qiniu\Auth; use Qiniu\Storage\UploadManager; // 用于签名的公钥和私钥 $accessKey = \'5cgg\'; $secretKey = \'6ab6\'; $bucket = \'buckname\'; // 初始化签权对象 $auth = new Auth($accessKey, $secretKey); // 生成上传Token $token = $auth->uploadToken($bucket); // 构建 UploadManager 对象 $uploadMgr = new UploadManager(); $php_path = dirname(__FILE__) . \'/\'; --原来的
.
.
.
.
.
.

//移动文件  --原来的
$file_path = $save_path . $new_file_name;

 

$key = "imgpath/".date(\'Y-m-d\')."-".rand(10000, 99999).".".$file_ext;
$result = $uploadMgr->putFile($token, $key, $tmp_name);

if ($result[0][\'key\'] == true)
{
$file_url = \'http://img.163.com/\'.$result[0][\'key\'];
}
else
{
alert("上传文件失败。");
}

header(\'Content-type: text/html; charset=UTF-8\');  --原来的

 

分类:

技术点:

相关文章: