emoji同样是编码,之前tyecho采用general的utf8编码,所以无法写入

1.修改数据库编码
选择utf8mb4_unicode_ci

2.修改数据库表编码
运行以下sql语句

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->addServer(array (

  'host'      =>  localhost,

  'user'      =>  'youruser',

  'password'  =>  'yourpassword',

  'charset'   =>  'utf8mb4', //修改这一行

  'port'      =>  3306,

  'database'  =>  'yourdatabase'

), Typecho_Db::READ | Typecho_Db::WRITE);

评论




Blog content follows the Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) License

loading...loading... , total visits times