这个图片还能看见的话,就说明没有问题。
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 );