PHP后台请求小程序直播列表异常,怎么处理?
发布于 4 年前 作者 chaoyin 5334 次浏览 来自 官方Issues
 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;

回到顶部