Convert arrays into UTF-8 ? PHP JSON

前端 未结 7 1869
盖世英雄少女心
盖世英雄少女心 2021-01-03 01:56

i have multidimensional arrays generated by PHP with data from database ,but i have chars like \"č ć š đ ž\" and when i try to output that in json he just returns null , i d

7条回答
  •  臣服心动
    2021-01-03 02:21

    I met this problem as well and in 2016 you don't need to create a function, just use 'mb_convert_variables'

    mb_convert_variables('UTF-8', 'original encode', array or object)

    For anyone who meet this situation, too.

提交回复
热议问题