二維碼生氣錯(cuò)誤-$ticket為空
function getQrCode(){
//獲取ticket
$access_token=$this->getWxAccessToken();
$url='https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token='.$access_token;
//{"expire_seconds": 604800, "action_name": "QR_SCENE", "action_info": {"scene": {"scene_id": 123}}}
$postArr=array(
'action_name'=>'604800',//24*60*60*7 7天時(shí)間
'action_name'=>'QR_LIMIT_SCENE',
'action_info'=>array(
'scene'=>array('scene_id'=>2000),
),
);
$postJson=json_encode($postArr);
$res=$this->http_curl($url,'post','json',$postJson);
$ticket=$res['ticket'];
$url="https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=".urlencode($ticket);
echo "<img src='".$url."'/>";
}
2016-10-10
臨時(shí)二維碼的action_name=QR_SCENE
QR_LIMIT_SCENE是永久二維碼