网上都说了unicode表情 须要mysql5.5.3以后,个人版本是mysql 5.5.38 因此是支持的,只须要按照以下配置php
而后后重启下便可mysql
[client] default-character-set = utf8mb4 [mysqld] character-set-server=utf8mb4 collation-server=utf8mb4_unicode_ci [mysql] default-character-set = utf8mb4
另外是php的连接方式也须要改下sql
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提交接收的。post
参考资料:http://my.oschina.net/leejun2005/blog/343353.net
http://bbs.csdn.net/topics/390862460code