How to define the use of utf-8 in Doctrine 2 in Zend Framework application.ini, when using Bisna

前端 未结 8 1708
暖寄归人
暖寄归人 2020-12-28 08:22

The following ZendCasts cast, shows a way to use doctrine 2 in a zend framework environment.
Using this configuration, how can I make the connection use a utf-8 charset

8条回答
  •  無奈伤痛
    2020-12-28 08:41

    works fine for me

    resources.doctrine.dbal.connections.default.parameters.driverOptions.1002 = "SET NAMES 'UTF8'"
    

    1002 is the integer value of PDO::MYSQL_ATTR_INIT_COMMAND:

    Command to execute when connecting to the MySQL server. Will automatically be re-executed when reconnecting. Note, this constant can only be used in the driver_options array when constructing a new database handle.

提交回复
热议问题