is that the return has neither error nor data, and the document says it will return binary and convert it to a picture. But now there is nothing. I don"t know what went wrong. Ask for help
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;
}
}