从新浪云SAE上传图片到图文消息,只能用于图文消息中,
没有个数限制
if (!empty($_FILES[‘qrcode‘][‘name‘])){ $filename = time().".jpg"; file_put_contents(SAE_TMP_PATH."/".$filename, file_get_contents($_FILES[‘qrcode‘][‘tmp_name‘])); Vendor(‘Weixin.wxyhq_class‘); $weixin = new \weixin(); $data2 = array("media" => "@".SAE_TMP_PATH.$filename); //////// $result2 = $weixin->upload_image_media_raw($data2); if (isset($result2[‘url‘])){ $data[‘picture‘] = $result2[‘url‘]; $member->add($data); $this->success(‘添加成功!‘,‘member‘); }else{ $this->error(‘qrcode 失败‘); } }else{ $this->error(‘qrcode 没有‘); } $data = array("media" => "@".SAE_TMP_PATH.$filename); $result2 = $weixin->upload_image_media_raw($data); var_dump($result2);
原文地址:https://www.cnblogs.com/txw1958/p/11173381.html
时间: 2024-10-09 15:55:21