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

后端 未结 8 853
迷失自我
迷失自我 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条回答
  •  旧巷少年郎
    2020-11-28 04:30

    Itay,

    A very good question. Fortunately for you the answer is very simple:

    database.params.driver_options.1002 = "SET NAMES utf8"
    

    1002 is the value of constant PDO::MYSQL_ATTR_INIT_COMMAND

    You can't use the constant in the config.ini

提交回复
热议问题