php使用mysqli从mysql数据库中加密utf-8字符

php使用mysqli从mysql数据库中加密utf-8字符,php,mysql,utf-8,mysqli,cjk,Php,Mysql,Utf 8,Mysqli,Cjk,我有一些汉字(例如中文(简体))存储在内容类型为utf8\u bin的mysql数据库中 我使用以下代码从数据库中提取: if($stmt = $mysqli->prepare("SELECT c_color FROM colors")){ $stmt->execute(); $stmt->bind_result($ccolor); $stmt->store_result(); if($stmt->fetch()){ /

我有一些汉字(例如
中文(简体))存储在内容类型为utf8\u bin的mysql数据库中

我使用以下代码从数据库中提取:

if($stmt = $mysqli->prepare("SELECT c_color FROM colors")){
   $stmt->execute();    
   $stmt->bind_result($ccolor);
   $stmt->store_result();
   if($stmt->fetch()){
       //$ccolor is filled with question marks
   }
我做错了什么?我有

header('Content-type: text/html; charset=UTF-8') ;

页面上显示的是中文字符。php似乎有问题。

您可能需要将连接设置为使用utf-8。 您可以在配置中进行设置,也可以使用

更多信息: