加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

微信创建菜单报 must use utf-8 charset hint 错误

发布时间:2020-12-14 02:45:00 所属栏目:Windows 来源:网络整理
导读:? php include ‘../WeiXinApi/WeiXinApi.php‘ ; // 创建菜单. $access_token = getToken(); if ( $access_token ==‘-1‘ ) { echo ("get token failed" ); exit (); } $getCreatMenuUrl =‘https://api.weixin.qq.com/cgi-bin/menu/create?access_token=
<?php
    include ‘../WeiXinApi/WeiXinApi.php‘;
    //创建菜单.
    $access_token= getToken();
    if ($access_token ==‘-1‘)
    {
        echo ("get token failed");
        exit();
    }
    $getCreatMenuUrl=‘https://api.weixin.qq.com/cgi-bin/menu/create?access_token=‘.$access_token;
    $jsonStr= ‘{"button":[{"type":"click","name":"今日歌曲","key":"V1001_TODAY_MUSIC"},{"name":"菜单","sub_button":[{"type":"view","name":"搜索","url":"http://www.soso.com/"},{"type":"click","name":"赞一下我们","key":"V1001_GOOD"}]}]}‘;
    //$jsonStr=json_encode($jsonStr,JSON_UNESCAPED_UNICODE); 
    $responsJson=http_post_json($getCreatMenuUrl,$jsonStr);
    echo ($responsJson[0] . $responsJson[1]);
    
?>

这是因为本身windows平台文件是不是默认utf-8格式的,另存为把文件改成utf-8格式.. 运行正确.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读