Home  >  Article  >  Backend Development  >  ios php mysql 支持unicode表情 插入问号问题

ios php mysql 支持unicode表情 插入问号问题

WBOY
WBOYOriginal
2016-06-20 12:35:33995browse

网上都说了unicode表情 需要mysql5.5.3之后,我的版本是mysql 5.5.38 所以是支持的,只需要按照如下配置

然后后重启下即可

[client]default-character-set = utf8mb4[mysqld]character-set-server=utf8mb4collation-server=utf8mb4_unicode_ci[mysql]default-character-set = utf8mb4


另外是php的链接方式也需要改下

define('DNS', 'mysql:host=localhost;dbname=test;charset=utf8mb4');define('USR', 'root');define('PWD', '123456');define('MAXLIFETIME', 1440);try {      $pdo = new Pdo ( DNS, USR, PWD);} catch ( PDOException $e ) {      throw new Exception ( 'Connection failed: ' . $e->getMessage () );}


如此设置就可以了。 对了 我用的是post提交接收的。


参考资料:http://my.oschina.net/leejun2005/blog/343353

http://bbs.csdn.net/topics/390862460

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn