1.首先获取接口调用凭证 access_token
接口地址 :GET https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET
/**
* 微信小程序获取接口调用凭证AccessToken
*/
public function get_access_token()
{
$appid = config('wechat.app_id');// 小程序appid
$secret = config('wechat.secret'); // 小程序appsecret
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$appid&secret=$secret";
$user_obj = $this->curlHttp($url);
session('access_token',$user_obj['access_token']);
return $user_obj['access_token'