public function up(){
$toke = S('token');
if (empty($token)) {
$this->getaccess_token();
$toke = S('token');
}
$token=json_decode($toke,true)['access_token'];
$url="https://api.weixin.qq.com/cgi-bin/media/upload?access_token=".$token."&type=image";
$data['type']='image';
$data['media']='./Data/UploadFiles/product/20181016/1539656106182935.PNG';
$postData=json_encode($data);
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);//流的形势不直接输出
//设置是通过post还是get方法
curl_setopt($ch,CURLOPT_POST,1);
//传递的变量
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE);//不检查证书
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,FALSE);//不检查证书名
curl_setopt($ch,CURLOPT_POSTFIELDS,$postData);
$da = curl_exec($ch);
curl_close($ch);
dump($da);die;
}
返回却是
string(70) "{"errcode":41005,"errmsg":"media data missing hint: [lVllaa02931335]"}"
解决了PHP7需要new file
可以把解决的代码发下嘛?
按照你的方法写的,上传不成功,可以请问你一下嘛