// 生成带参数二维码 public function create_qrcode($scene_type, $scene_id) { switch ($scene_type) { case 'QR_LIMIT_SCENE' : // 永久二维码 $data = '{"action_name": "QR_LIMIT_STR_SCENE", "action_info": {"scene": {"scene_str": "' . $scene_id . '"}}}'; break; case 'QR_SCENE' : // 临时二维码 $data = "{\"expire_seconds\": 1800, \"action_name\": \"QR_SCENE\", \"action_info\": {\"scene\": {\"scene_id\": $scene_id}}}"; break; } $url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" . $this->access_token; $res = $this->https_request ( $url, $data ); $result = json_decode ( $res, true ); return "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" . urlencode ( $result ["ticket"] ); }