Monday, May 18, 2009

[Zen Cart] 設定記錄-- 中文有亂碼 處理方式

Modify this file :
includes/classes/db/mysql/query_factory.php

 


Search this block of codes

if (@mysql_select_db($zf_database, $this->link)) { 
    $this->db_connected = true; 
    return true; 
} 
else { 
    $this->set_error(mysql_errno(),mysql_error(), $zp_real); 
    return false; 
} 

將其修改成

if (@mysql_select_db($zf_database, $this->link)) { 
    $this->db_connected = true; 
    // *** Add Start *** 
    mysql_query("SET NAMES 'utf8'", $this->link); 
    mysql_query("SET CHARACTER SET UTF8", $this->link); 
    // *** Add End *** 
    return true; 
} 
else { 
    $this->set_error(mysql_errno(),mysql_error(), $zp_real); 
    return false; 
} 

0 comments:

Post a Comment