ios php mysql 支持unicode表情 插入問號問題

網上都說了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

相關文章
相關標籤/搜索