PHP7中文手册2018 带注释 最新chm版
public function actionT($mid){
//mid的获取 $images = trim($weixin->msg->MediaId);
$url = "https://api. weixin.qq.co m/cgi-bin/to ken?";
$data = array(
'grant_type'=>'client_credential',
'appid'=>'wxe50cexxxc9',
'secret'=>'6912e6ee67e4xxxxxd27e4ec87'
);
$file = self::getcurl($url,$data);
$josn = json_decode($file,true);
$token = $josn['access_token'];
file_put_contents('./uploads/xx.jpg', file_get_contents($urls));
return true;
}public function getcurl($url,$data=array()){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
// 这一句是最主要的
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch) ;
return $response;
}
转载请注明:谷谷点程序 » php微信公众号读取用户上传的图片,并保存到网站