【问题标题】:How to fetch data from database as utf-8 CodeIgniter [duplicate]如何以utf-8 CodeIgniter从数据库中获取数据[重复]
【发布时间】:2020-11-22 07:09:12
【问题描述】:

这种编码方式是什么:

Kết nối nông nghiệp Việt

应该是“Kết nối nông nghiệp Việt”,但视图无法呈现 utf-8,我不知道为什么。请看下面的图片。

数据库配置:

    ORM::configure(array(
    'connection_string' => 'mysql:host='.$db_hostname.';dbname='.$db_name.'',
    'username' => ''.$db_username.'',
    'password' => ''.$db_password.''
));
    //ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); #i tried uncomment this line but it's still not working
    //ORM::configure('error_mode', PDO::ERRMODE_WARNING);
    //ORM::configure('return_result_sets', true);
    //ORM::configure('logging', true);

【问题讨论】:

    标签: php mysql codeigniter


    【解决方案1】:

    编辑Collat​​ion类型列为:utf8mb4_unicode_ci

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-29
      • 1970-01-01
      • 1970-01-01
      • 2016-12-16
      • 1970-01-01
      • 2019-08-09
      相关资源
      最近更新 更多