比如,在线等,请大神赐教:

解决方案 »

  1.   

    dingyixia
      

  2.   

    zaidingyixia
      

  3.   

    不知道你要做什么mysql 存储 emoji 表情符,需选用 utf8mb4 字符集
      

  4.   

    那请问在微网站里显示emoji 表情符该怎么做编码处理呢?
    mysql> status;
    --------------
    mysql  Ver 14.14 Distrib 5.6.31, for Linux (x86_64) using  EditLine wrapperConnection id: 27640
    Current database: zuwo
    Current user: root@localhost
    SSL: Not in use
    Current pager: stdout
    Using outfile: ''
    Using delimiter: ;
    Server version: 5.6.31 MySQL Community Server (GPL)
    Protocol version: 10
    Connection: Localhost via UNIX socket
    Server characterset: latin1
    Db     characterset: latin1
    Client characterset: utf8
    Conn.  characterset: utf8
    UNIX socket: /var/lib/mysql/mysql.sock
    Uptime: 29 days 9 hours 25 min 11 secThreads: 1  Questions: 168219  Slow queries: 0  Opens: 99  Flush tables: 1  Open tables: 79  Queries per second avg: 0.066
    --------------mysql> show create table `cc_baseinfo`;
    +-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | Table       | Create Table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
    +-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | cc_baseinfo | CREATE TABLE `cc_baseinfo` (
      `userid` int(11) NOT NULL AUTO_INCREMENT,
      `openid` char(100) NOT NULL,
      `nickname` char(50) DEFAULT NULL,
      `sex` enum('0','1') DEFAULT NULL,
      `language` char(10) DEFAULT NULL,
      `city` char(30) DEFAULT NULL,
      `province` char(30) DEFAULT NULL,
      `country` char(30) DEFAULT NULL,
      `headimgurl` char(225) DEFAULT NULL,
      `privilege` char(30) DEFAULT NULL,
      `unionid` char(100) DEFAULT NULL,
      `registertime` datetime DEFAULT NULL,
      `logintime` datetime DEFAULT NULL,
      `phone` char(15) DEFAULT NULL,
      `age` tinyint(3) unsigned DEFAULT NULL,
      `stature` tinyint(3) unsigned DEFAULT NULL,
      `profession` char(40) DEFAULT NULL,
      `weixinhao` char(255) DEFAULT NULL,
      `picureurl` char(225) DEFAULT NULL,
      `chuzufanwei` char(225) DEFAULT NULL,
      `shixin` decimal(10,2) DEFAULT NULL,
      `rixin` decimal(10,2) DEFAULT NULL,
      `chengyi` char(255) DEFAULT NULL,
      `dangqi` char(255) DEFAULT NULL,
      `tedian` char(255) DEFAULT NULL,
      `status` enum('0','1','2','3','4','5') DEFAULT '0',
      `picureurl2` char(255) DEFAULT NULL,
      `picureurl3` char(255) DEFAULT NULL,
      `picureurl4` char(255) DEFAULT NULL,
      `picureurl5` char(255) DEFAULT NULL,
      `picureurl6` char(255) DEFAULT NULL,
      `shangjiareason` char(255) DEFAULT NULL,
      `shimingreason` char(255) DEFAULT NULL,
      `neverreason` char(255) DEFAULT NULL,
      `shiming` enum('0','1','2','3') DEFAULT '0',
      `mecity` char(30) DEFAULT NULL,
      `mesex` char(100) DEFAULT NULL,
      `meage` char(100) DEFAULT NULL,
      `mestature` char(100) DEFAULT NULL,
      `mepaixu` char(100) DEFAULT NULL,
      `zhaohu` int(11) DEFAULT NULL,
      `star` tinyint(3) unsigned DEFAULT NULL,
      `picureurl7` char(255) DEFAULT NULL,
      `picureurl8` char(255) DEFAULT NULL,
      `sfzcode` char(25) DEFAULT NULL,
      `zsname` char(25) DEFAULT NULL,
      `dingweicity` char(30) DEFAULT NULL,
      `dingweiprovince` char(30) DEFAULT NULL,
      `shimingtime` datetime DEFAULT NULL,
      PRIMARY KEY (`userid`)
    ) ENGINE=InnoDB AUTO_INCREMENT=124 DEFAULT CHARSET=utf8mb4 |
    +-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)mysql> 而且现在还有bug,字符集插入数据库就显示4个????     
      

  5.   

    四个?只是mysql的显示问题,mysql无法显示不能代表数据有问题,只要php读取的是正确的就行了。
    emoji是二进制编码,一般直接输出到html里是无法显示的
    最简单的验证方法是用二进制去校验读出来的有没有问题
    比如这样验证:
    if ($value === "\uXXXX\uXXXX\uXXXX")