PHP PDO: charset, set names?

前端 未结 9 723
孤独总比滥情好
孤独总比滥情好 2020-11-22 06:49

I had this previously in my normal mysql_* connection:

mysql_set_charset(\"utf8\",$link);
mysql_query(\"SET NAMES \'UTF8\'\");

Do I need it

9条回答
  •  情歌与酒
    2020-11-22 07:20

    Prior to PHP 5.3.6, the charset option was ignored. If you're running an older version of PHP, you must do it like this:

     exec("set names utf8");
    
    ?>
    

提交回复
热议问题