我现在要显示中文,难道每次查询之前都要执行一下SET NAMES 'utf8'吗?
我现在要显示中文,难道每次查询之前都要执行一下SET NAMES 'utf8'吗?
我找到了
设置CDbConnection的charset属性即可。
大意了~~
我今天也遇到这个问题了,按照楼上的方法解决了,谢谢。
main.php:
‘db’=>array(
'connectionString'=>'mysql:host=localhost;dbname=study',
'username'=>'root',
'password'=>'jeri',
'charset'=>'utf8',//use charset as utf8
'enableParamLogging'=>'true',//to log the parameter value
),