2020-10-21

PHP 后台获取微信TICKET,获取二维码

public function getErWeiMa($token,$openids){

$url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=".$token;
$data='{"expire_seconds": 2592000, "action_name": "QR_STR_SCENE", "action_info": {"scene": {"scene_str": "’.$openids.’"}}}’;
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CLRLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
curl_setopt($ch,CURLOPT_RETURNIRANSFER,1);
$output=curl_exec($ch);
curl_close($ch);
echo’返回值:’.$output;
$json=json_decode($output,true);
return $output;

}

php集成碰到一个问题,微信获取微信TICKET,获取二维码。调用上述函数,出现返回值$output 为空,json_decode 后,echo 没有值,无法获取TICKET 值。

那位同学指点下

https://q.cnblogs.com/q/128513/

发表回复

Your email address will not be published. Required fields are marked *