微信扫一扫核销结合tp5后台
1./**
* 获取access_token
*
* @return void
*/
public function get_access_token(){
$appID = "wx3da9056cdd06e96c";
$appsecret="a3f53afb773f0488ce8f842059bd6bf6";
$get_url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appID."&secret=".$appsecret;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $get_url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl);
curl_close($curl);
// dump($data);die;
$token = json_decode($data);
return($token->access_token);
}
2./**
* 通过token获取jsapi_ticket(票据)
*
* @return void
*/
public function get_jsapi_ticket(){
$access_token=$this->get_access_token();
$get_ticket_url="https://api.weixin.qq.com/cgi-bin/ticket/getticket?ac