Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

小程序生成二维码问题 #568

Closed
cloudsthere opened this issue Jan 10, 2017 · 4 comments
Closed

小程序生成二维码问题 #568

cloudsthere opened this issue Jan 10, 2017 · 4 comments

Comments

@cloudsthere
Copy link

我用的环境

PHP 版本:5.6.10
overtrue/wechat 版本:dev-master

问题及现象

小程序生成二维码接口(EasyWeChat\MiniProgram\QRCode\QRCode::create())的请求类型不能使用'POST',改成“JSON"后微信服务器才能识别,我已经提了pr(#567)。

但这里要说的问题是,即使返回成功,也有问题。

因为微信直接返回了图片,content-type : image/jpeg, 而在EasyWechat\Core\Http::parseJson()中有一段检测代码:

$body = $this->fuckTheWeChatInvalidJSON($body);

if (empty($body)) {
    return false;  // 在这个接口,即使请求成功也会在这里返回
}

不知道作者当初是怀着怎样的心想写下这个霸气侧漏的函数,所以我也没有修改意见。

@yulinho
Copy link

yulinho commented Jun 7, 2017

哈哈

@overtrue
Copy link
Collaborator

overtrue commented Jun 8, 2017

@yulinho 🤣

@wuzuzhen
Copy link

wuzuzhen commented Sep 8, 2017

~~

@liumingzhij26
Copy link

liumingzhij26 commented Dec 8, 2017

确实有问题,page 路径必须是已经上线的路径

$params = [
                'scene' => $scene,
                'page' => 'pages/index/index',
                'width' => 430,
                'auto_color' => false,
                'line_color' => ['r' => 0, 'g' => 0, 'b' => 0],
            ];
            $curl = new Curl\Curl();
            $curl->post('https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=' . $token, json_encode($params));
            $curl->setHeader('content-type', 'application/json');
            $image = $curl->response;//二进制图片

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants