json_encode is returning NULL?

前端 未结 10 2037
[愿得一人]
[愿得一人] 2020-11-22 12:22

For some reason the item \"description\" returns NULL with the following code:



        
10条回答
  •  时光说笑
    2020-11-22 12:57

    For anyone using PDO, the solution is similar to ntd's answer.

    From the PHP PDO::__construct page, as a comment from the user Kiipa at live dot com:

    To get UTF-8 charset you can specify that in the DSN.

    $link = new PDO("mysql:host=localhost;dbname=DB;charset=UTF8");

提交回复
热议问题