MENU
// //

Typecho博客支持Emoji表情

June 10, 2020 • typecho

博主还是比较喜欢使用emoji小表情的?
话不多说,开始魔改!! ::(滑稽)

1、修改数据库编码

登陆你的PHPMyadmin,找到Typecho博客所在的数据库,选择数据库,操作->排序规则-----修改为utf8mb4_unicode_c
排序规则

2、修改数据库表存储的编码

alter table typecho_comments convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_contents convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_fields convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_metas convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_options convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_relationships convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_users convert to character set utf8mb4 collate utf8mb4_unicode_ci;

3、修改网站根目录的数据库配置文件

修改配置文件config.inc.php

/** 定义数据库参数 */
$db = new Typecho_Db('Mysql', 'typecho_');
$db->addServer(array (
  'host' => 'localhost',
  'user' => 'root',
  'password' => 'MfyAEB8EMWsbKp5m',
  'charset' => 'utf8mb4',   //注意utf8改为utf8mb4  只改这里就可以哦
  'port' => '3306',
  'database' => 'typecho',
), Typecho_Db::READ | Typecho_Db::WRITE);
Typecho_Db::set($db);
Last Modified: September 19, 2023