dongliang1654 2018-06-01 09:42
浏览 96
已采纳

错误的字符集get_error_message()wordpress

There is PHP method in my API for handling POST requests:

...

$user_id = wp_create_user( $user_login, $user_pass, $user_login );

if ( is_wp_error( $user_id ) ) {
    $base_response['message'] = $user_id->get_error_message();
    $base_response['status'] = false;
    return json_encode ($base_response);
}

...

If user already exists, I get error message, but why this message ($base_response['message']) has unicode format: "u041du0430 u0436u0430u043bu044c, u0446u0435 u0456u043c'u044f u043au043eu0440u0438u0441u0442u0443u0432u0430u0447u0430 u0432u0436u0435 u0456u0441u043du0443u0454!". How to change this?

  • 写回答

2条回答 默认 最新

  • dqthn68688 2018-06-01 10:16
    关注

    The problem was in cyrillic language for wordpress site and json_encode could not correctly convert cyrillic message. When I changed the language in the wordpress admin to English, everything is fine now.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应