2012-07-16 25 views

回答

6

只要告訴您在使用UTF-8 MySQL和PHP:

<?php 
    mb_internal_encoding("UTF-8"); 

    $db = new PDO('mysql:host=localhost;dbname=testdb;charset=UTF-8', 'username', 'password'); 
?> 
+0

確定。我會盡力。我把我的數據庫設置爲UTF8和UTF8_Unicode_ci – user1526609 2012-07-16 07:46:52

+0

它將右側字符插入到數據庫中,但在瀏覽器中顯示如下:「РљРѕјјμјμμЅЅ,РёёЂЂѕѕѕѕ°Њ」「(西里爾文) – user1526609 2012-07-16 07:51:02

+1

然後告訴瀏覽器使用utf-8 :'header('Content-type:text/html; charset = utf-8');' – 2012-07-16 07:52:52