fixed garbled chinese characters

This commit is contained in:
printempw 2016-03-19 11:31:44 +08:00
parent 959298e43a
commit 70c2cd74cd
2 changed files with 4 additions and 3 deletions

View File

@ -3,7 +3,7 @@
* @Author: printempw * @Author: printempw
* @Date: 2016-03-18 14:02:12 * @Date: 2016-03-18 14:02:12
* @Last Modified by: printempw * @Last Modified by: printempw
* @Last Modified time: 2016-03-18 17:24:13 * @Last Modified time: 2016-03-19 11:25:06
*/ */
use Database\Database; use Database\Database;
@ -21,6 +21,7 @@ class Config
public static function set($key, $value) { public static function set($key, $value) {
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, DB_PORT); $conn = new mysqli(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, DB_PORT);
$conn->query("SET names 'utf8'");
$sql = "UPDATE ".DB_PREFIX."options SET `option_value`='$value' WHERE `option_name`='$key'"; $sql = "UPDATE ".DB_PREFIX."options SET `option_value`='$value' WHERE `option_name`='$key'";
$result = $conn->query($sql); $result = $conn->query($sql);
if ($conn->error) if ($conn->error)

View File

@ -3,7 +3,7 @@
* @Author: printempw * @Author: printempw
* @Date: 2016-02-02 21:59:06 * @Date: 2016-02-02 21:59:06
* @Last Modified by: printempw * @Last Modified by: printempw
* @Last Modified time: 2016-03-18 18:47:20 * @Last Modified time: 2016-03-19 11:25:11
*/ */
namespace Database; namespace Database;
@ -33,7 +33,7 @@ class Database implements EncryptInterface, SyncInterface
Utils::showErrorPage(-1, "数据库中不存在 ".DB_PREFIX."users 或 ".DB_PREFIX."options 表。请先运行 /admin/install.php 进行安装。"); Utils::showErrorPage(-1, "数据库中不存在 ".DB_PREFIX."users 或 ".DB_PREFIX."options 表。请先运行 /admin/install.php 进行安装。");
if (!is_dir(BASE_DIR."/textures/")) if (!is_dir(BASE_DIR."/textures/"))
Utils::showErrorPage(-1, "textures 文件夹不存在。请先运行 /admin/install.php 进行安装,或者手动放置一个。"); Utils::showErrorPage(-1, "textures 文件夹不存在。请先运行 /admin/install.php 进行安装,或者手动放置一个。");
$conn->query("SET names 'utf8'");
return $conn; return $conn;
} }