“晚风吹人醒 万事藏于心 
        我没说不公平 也没说苦 我说我知道了”
// 生成带参数二维码
    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"] );
    }

 

posted on 2023-02-14 09:54  诗里刻画的影子  阅读(78)  评论(0编辑  收藏  举报