手把手教你让你的wecenter支持emoji表情
前提是,你的mysql数据库需要支持utf8mb4。你的数据库版本要大于等于MySQL 5.5.3,因为低版本不支持utf8mb4字符集。数据库版本低于MySQL 5.5.3的,请自行升级。
修改system/config/database.php
把utf8 改成utf8mb4
修改数据库字符集
ALTER SCHEMA `database_wecenter` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci ;
修改表的字符集
ALTER TABLE `aws_answer`
CHARACTER SET = utf8mb4 , COLLATE = utf8mb4_unicode_ci ,
CHANGE COLUMN `answer_content` `answer_content` TEXT CHARACTER SET 'utf8mb4' NULL DEFAULT NULL COMMENT '回答内容' ;
ALTER TABLE `aws_answer_comments`
CHARACTER SET = utf8mb4 , COLLATE = utf8mb4_unicode_ci ,
CHANGE COLUMN `message` `message` TEXT CHARACTER SET 'utf8mb4' NULL DEFAULT NULL ;
ALTER TABLE `aws_approval`
CHARACTER SET = utf8mb4 , COLLATE = utf8mb4_unicode_ci ,
CHANGE COLUMN `data` `data` MEDIUMTEXT CHARACTER SET 'utf8mb4' NOT NULL ;
ALTER TABLE `aws_article`
CHARACTER SET = utf8mb4 , COLLATE = utf8mb4_unicode_ci ,
CHANGE COLUMN `title` `title` VARCHAR(255) CHARACTER SET 'utf8mb4' NOT NULL ,
CHANGE COLUMN `message` `message` TEXT CHARACTER SET 'utf8mb4' NULL DEFAULT NULL ;
ALTER TABLE `aws_article_comments`
CHARACTER SET = utf8mb4 , COLLATE = utf8mb4_unicode_ci ,
CHANGE COLUMN `message` `message` TEXT CHARACTER SET 'utf8mb4' NOT NULL ;
ALTER TABLE `aws_draft`
CHARACTER SET = utf8mb4 , COLLATE = utf8mb4_unicode_ci ,
CHANGE COLUMN `data` `data` TEXT CHARACTER SET 'utf8mb4' NULL DEFAULT NULL ;
ALTER TABLE `aws_inbox`
CHARACTER SET = utf8mb4 , COLLATE = utf8mb4_unicode_ci ,
CHANGE COLUMN `message` `message` TEXT CHARACTER SET 'utf8mb4' NULL DEFAULT NULL COMMENT '内容' ;
ALTER TABLE `aws_notification_data`
CHARACTER SET = utf8mb4 , COLLATE = utf8mb4_unicode_ci ,
CHANGE COLUMN `data` `data` TEXT CHARACTER SET 'utf8mb4' NULL DEFAULT NULL ;
ALTER TABLE `aws_question`
CHARACTER SET = utf8mb4 , COLLATE = utf8mb4_unicode_ci ,
CHANGE COLUMN `question_content` `question_content` VARCHAR(255) CHARACTER SET 'utf8mb4' NOT NULL DEFAULT '' COMMENT '问题内容' ,
CHANGE COLUMN `question_detail` `question_detail` TEXT CHARACTER SET 'utf8mb4' NULL DEFAULT NULL COMMENT '问题说明' ;
ALTER TABLE `aws_question_comments`
CHARACTER SET = utf8mb4 , COLLATE = utf8mb4_unicode_ci ,
CHANGE COLUMN `message` `message` TEXT CHARACTER SET 'utf8mb4' NULL DEFAULT NULL ;
ALTER TABLE `aws_topic`
CHARACTER SET = utf8mb4 , COLLATE = utf8mb4_unicode_ci ,
CHANGE COLUMN `topic_title` `topic_title` VARCHAR(64) CHARACTER SET 'utf8mb4' NULL DEFAULT NULL COMMENT '话题标题' ,
CHANGE COLUMN `topic_description` `topic_description` TEXT CHARACTER SET 'utf8mb4' NULL DEFAULT NULL COMMENT '话题描述' ;
ALTER TABLE `aws_users`
CHARACTER SET = utf8mb4 , COLLATE = utf8mb4_unicode_ci ,
CHANGE COLUMN `user_name` `user_name` VARCHAR(255) CHARACTER SET 'utf8mb4' NULL DEFAULT NULL COMMENT '用户名' ;
修改my.cnf,此步可以省略,不是必须的。
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
重启数据库。
现在你可以使用emoji表情了。
示例网站http://www.kandaoni.com
阅读全文
收起全文