PHP开发微信自定义菜单40033不转义中文的方法

xiaoxiao2021-02-28  92

接口文档说明: http://mp.weixin.qq.com/wiki/13/43de8269be54a0a6f64413e4dfa94f39.html

按照文档走,使用php执行,结果: {“errcode”:40033,”errmsg”:”invalid charset. please check your request, if include \uxxxx will create fail!”}

上网查询资料,结果显示: 如果php的版本在5.4+: menu=jsonencode( menuStr, JSON_UNESCAPED_UNICODE);

否则: menu=jsonencode( menuStr, JSON_UNESCAPED_UNICODE); menu=urldecode( menu);

菜单中有中文的时候这样处理,不会转义汉字,也就不会报错了.

转载请注明原文地址: https://www.6miu.com/read-72198.html

最新回复(0)