微信创建菜单报 must use utf-8 charset hint 错误
<?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格式.. 运行正确.
QQ:309488423
Email:leiliu_lucfer@163.com