遇到的問題就是,返回既沒有報錯,也沒有數(shù)據(jù),文檔說會返回二進制,轉(zhuǎn)為圖片。但現(xiàn)在是什么都沒有,不知道哪里出了問題,求助
這是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業(yè)務(wù)邏輯處理部分
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 回答
- 0 關(guān)注
- 733 瀏覽
添加回答
舉報
0/150
提交
取消