遇到的问题就是,返回既没有报错,也没有数据,文档说会返回二进制,转为图片。但现在是什么都没有,不知道哪里出了问题,求助
这是contorller部分
function getIssueQrcodeAction()
{
// $issueId = $this->request->getPost('issueId');
$issueId = 2;
$page = 'pages/listPage/article/article?issueId=';
$test = new GetQrcode();
$t = $test->get_qrcode($page,$issueId);
print_r($t);
}
这是service业务逻辑处理部分
Class GetQrcode
{
public function get_qrcode($page,$issueId) {
header('content-type:image/png');
$uid = 6;
$data = array();
$data['scene'] = $issueId;
$data['page'] = $page;
$date['width'] = 450;
$data = json_encode($data);
// $access = json_decode($this->get_access_token(),true);
$a = new WeixinUsers();
$access_token = $a->access_token();
$url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=".$access_token;
$da = $this->get_http_array($url,$data);
return json_encode(array('pictures'=>$da));
// $this->assign('data',$da);
// $this->fetch();
}
public function get_http_array($url,$post_data) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //没有这个会自动输出,不用print_r();也会在后面多个1
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = curl_exec($ch);
curl_close($ch);
$out = json_decode($output);
return $out;
}
}
https://mp.weixin.qq.com/debu...
8 回答
慕容森
TA贡献1853条经验 获得超18个赞
$data = [
'scene'=>$issueId,
'page'=>$page,
'width'=>450,
'auto_color'=>false,
'line_color'=>["r"=>0,"g"=>0,"b"=>0],
];
把参数都加上试试,应该是有返回的
- 8 回答
- 0 关注
- 698 浏览
添加回答
举报
0/150
提交
取消