{"errcode":40033,"errmsg":"invalid charset. please check your request, if include \\uxxxx will create fail!"}不支持unicode字符!<?php
$data = array(
"name"=>"羊羊羊",
"type"=>"view",
"url"=>"http://xuan9806.com/"
);
echo json_encode($data, JSON_UNESCAPED_UNICODE), "\n"; 得到结果{"name":"羊羊羊","type":"view","url":"http:\/\/xuan9806.com\/"}<?php
$data = array(
"name"=>urlencode("羊羊羊"),
"type"=>"view",
"url"=>"http://xuan9806.com/"
);
$result = json_encode($data, JSON_UNESCAPED_UNICODE);
$result = urldecode($result);
echo $result, "\n";
同样得到法1中的结果。从微信自定义菜单说php json_encode不转义中文汉字的方法
原文地址:http://blog.csdn.net/qmhball/article/details/45690017