wang hou sheng 8 months ago
parent b55cb5bfc3
commit 077d6c60d9
  1. 24
      app/common/library/wxserver/Server.php

@ -144,21 +144,17 @@ class Server
if ($access_token) {
$savePath = root_path() . "public/wxserve/experience";
!is_dir($savePath) && mkdir($savePath, 0755, true);
$savePath .= '/' . $appid . 'jpg';
$savePath .= '/' . $appid . 'jpg'; //Client
$url = 'https://api.weixin.qq.com/wxa/get_qrcode?access_token=' . $access_token;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 如果你的环境没有安装证书,可以设置为 false,但生产环境不建议这样做
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // 同上
$qrcode_response = curl_exec($ch);
curl_close($ch);
dump($qrcode_response);
exit();
// $newFile = fopen($savePath, "a");
// fwrite($newFile, $qrcode_response);
// fclose($newFile);
return '/wxserve/experience/' . $appid . '.jpg';
$client = new \Qiniu\Http\Client();
$response = $client->get($url);
$res = $response->body();
if ($res) {
$newFile = fopen($savePath, "a");
fwrite($newFile, $res);
fclose($newFile);
return '/wxserve/experience/' . $appid . '.jpg';
}
}
}
return '';

Loading…
Cancel
Save