收藏
回答

PHP后台请求小程序直播列表异常,怎么处理?

 include "WeixinUtil.php";
 $wx = new WeixinUtil();
 $token = $wx->getAccessToken();
 $data = array(
    'start'=>0,
    'limit'=>10
 );
 $data = http_build_query($data);
 $options = array(
    'http'=>array(
        'method'=> 'POST',
        'header'=> 'Content-type:application/json;',
        'content'=> $data
    )
 );
 $url = 'https://api.weixin.qq.com/wxa/business/getliveinfo?access_token='.$token;
 $context = stream_context_create($options);
 $content = file_get_contents($url,false,$context);
 $json = json_encode($content,JSON_UNESCAPED_UNICODE);
 // 生成json结果
 echo $json;

回答关注问题邀请回答
收藏
登录 后发表内容