PHP開發微信自定義菜單不轉義中文的方法

接口文檔說明:
http://mp.weixin.qq.com/wiki/13/43de8269be54a0a6f64413e4dfa94f39.htmlphp

按照文檔走,使用php執行,結果:
{"errcode":40033,"errmsg":"invalid charset. please check your request, if include \uxxxx will create fail!"}html

上網查詢資料,結果顯示:
若是php的版本在5.4+:
$menu = json_encode($menuStr, JSON_UNESCAPED_UNICODE);json

不然:
$menu = json_encode($menuStr, JSON_UNESCAPED_UNICODE);
$menu = urldecode($menu);url

菜單中有中文的時候這樣處理,不會轉義漢字,也就不會報錯了.3d

相關文章
相關標籤/搜索