最近写文章编辑分类的时候无法添加一些Emoji表情,出现????,或者报错:Database Query Error
第一步
进入数据库后台,打开控制台,执行以下代码(找不到控制台? 在数据库后台首页的左下角就能看见)
alter table typecho_comments convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_contents convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_fields convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_metas convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_options convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_relationships convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_users convert to character set utf8mb4 collate utf8mb4_general_ci;
第二步
修改网站根目录数据库配置文件config.php(一般是这个名字)
/** 定义数据库参数 */
$db = new Typecho_Db('Pdo_Mysql', 'typecho_');
$db->addServer(array (
...
'charset' => 'utf8mb4', // 将原来的utf8修改为 utf8mb4
...
), Typecho_Db::READ | Typecho_Db::WRITE);
Typecho_Db::set($db);
评论 (0)