2017-02-15 39 views
1

這個字符串IM從MySQL和複製後,在這裏自動成爲表情符號圖標,小霸王PHP回聲的表情符號成爲問號,但在這裏貼的罰款

但是,當我使用PHP來呼應這個字符串,成爲小霸王?

爲什麼?

這是我從MySQL代碼

<?php 
$Recordset1 = new WA_MySQLi_RS("Recordset1",$locahost,0); 
$Recordset1->setQuery('SET character set utf8mb4'); 
$Recordset1->setQuery('SET NAMES utf8mb4'); 
$Recordset1->setQuery( 
" 
SELECT tbl_trans.trans_username, 
    Sum(Case When tbl_trans.trans_type <> 'REWARD' AND tbl_trans.trans_winlose <> 'QB' then 
     trans_winloseamount Else 0 End) BETHOST, 
    Sum(Case When tbl_trans.trans_winlose = 'QB' then 
     trans_winloseamount Else 0 End) QB, 
    Sum(Case When tbl_trans.trans_type = 'REWARD' then 
     trans_winloseamount Else 0 End) REWARD , 
    Sum(Case When tbl_trans.trans_type <> '' then 
     trans_winloseamount Else 0 End) NETWINLOSE 
FROM tbl_trans 
WHERE (trans_datetime > '".$datefrom. " 14:00:00' AND trans_datetime < '".$dateto." 12:00:00') 
GROUP BY trans_username"); 

$Recordset1->execute(); 
?>` 

和.PHP HTML文件<meta charset='utf-8'>

選擇,我已經試過header('Content-type: text/plain; charset=utf-8')


ALTER DATABASE wxbot_backup CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; ALTER TABLE tbl_trans CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE tbl_trans charset=utf8mb4, MODIFY COLUMN trans_username VARCHAR(45) CHARACTER SET utf8mb4

1件事我無法將其設置爲utf8mb4

mysql> SHOW VARIABLES LIKE 'character_set%'; SHOW VARIABLES LIKE 'collation%'; +--------------------------+---------------------------------------------------- -----+ | Variable_name | Value | +--------------------------+---------------------------------------------------- -----+ | character_set_client | gbk | | character_set_connection | gbk | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | gbk | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | C:\Program Files\MySQL\MySQL Server 5.6\share\chars ets\ | +--------------------------+---------------------------------------------------- -----+ 8 rows in set (0.00 sec)

以及如何設置character_set_client到utrfmb4?我正在使用窗口7

有什麼問題?

UPDATE
enter image description here

在MySQL的是這個樣子

+0

@DainisAbols這是沒有幫助在所有... – Connum

+0

對於MySQL,你需要使用'utf8mb4'而不是'utf8' - 設置connection-char設置,不要運行'SET NAMES utf8mb4' – Qirel

+0

你應該添加'$ Recordset1-> setQuery('SET character set utf8mb4'); '除了'SET NAMES'。通過PHP中的連接輸入字符串,還是通過phpMyAdmin手動輸入?表/列的排序規則設置是否也正確設置爲utf8mb4? – Connum

回答

0

問題與PHP代碼解決

$locahost->set_charset('utf8mb4');