折雨的天空
基于github试验了一下图片上传,还行
2020-5-3 我好笨





这个图片还能看见的话,就说明没有问题。



github: https://github.com/peng4740/autoPicCdn







主要准备用来存放图片,哈哈。



部分源码:







namespace ben\admin;


use ben\library\CurlPost;
use ben\library\pic;

include dirname(__DIR__).'/config/Config.php';
//改为你部署的github上面那个PHP的文件的地址
$url = "http://www.nidewangzhi.com/githubPic.php";
//修改图片大小
$imgFile=dirname(__DIR__).'/3.jpg';
pic::imageCropper($imgFile,500,330);

$post_data = array(
'pic' => '@'.$imgFile,
);
//上传图片要注意使用的是pic的索引。
$response = CurlPost::curl_http($url, 'POST', $post_data);
$params = array();
$params = json_decode($response,true);
if (isset($params['errcode']))
{
echo "error:" . $params['errcode'];
echo "msg :" . $params['errmsg'];
exit;
}
var_dump( $params );



发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容