Why echoing JSON encoded arrays won't produce any output

后端 未结 1 979
你的背包
你的背包 2021-01-22 18:32

I\'ve a little DB with 19elements, that\'s my PHP function to retrieve the DB:

function retrieveDB(){

    $tempDB=array();

    $database=new mysqli(DB_HOST,DB_         


        
相关标签:
1条回答
  • 2021-01-22 18:56

    The strings you retrieve from the database are not encoded as UTF-8 (they are ISO-8859-1, I presume). This is why json_encode() fails. It triggers a warning that says json_encode(): Invalid UTF-8 sequence in argument but your setup probably does not allow PHP display the errors.

    Put error_reporting(E_ALL & ~E_NOTICE); ini_set('display_errors', '1'); somewhere on top of your script and you'll see them.

    0 讨论(0)
提交回复
热议问题