How to make PDO run SET NAMES utf8 each time I connect, In ZendFramework

后端 未结 8 866
迷失自我
迷失自我 2020-11-28 04:11

How to make PDO adapter run SET NAMES utf8 each time I connect, In ZendFramework. I am using an INI file to save the adapter config data. what entries should I add there?

8条回答
  •  猫巷女王i
    2020-11-28 04:33

    The connection in zend_db is lazy which means it connects on the first query. if you have a static page with no query's in it it will never even connect - even if it is initialized in you bootstrap file.

    so running:

    $db->query("SET NAMES 'utf8'");
    

    Is not so smart. Big thanks to dcaunt for his solution.

提交回复
热议问题