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

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

WBOY
Release: 2016-06-20 12:35:33
Original
1057 people have browsed it

网上都说了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
Copy after login


另外是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 () );}
Copy after login


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


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

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

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template