乱码

来源:互联网 发布:淘宝网上卖什么挣钱 编辑:程序博客网 时间:2024/04/29 22:59

function db_connect()
{
   $result = new mysqli('localhost', 'bm_user', 'password', 'bookmarks');
   $result->set_charset('gbk');
   if (!$result)
     throw new Exception('Could not connect to database server');
   else
   {
 
   }
     return $result;
}

?>
如果使用了zendframework框架的话:

$db = Zend_Db::factory($config->db);
$db->query('SET NAMES gbk');