use test_001
insert into config (id, name, descr ) values ( '1', '中文名字', '描述' )
当 mysql命令不使用 --default-character-set 参数,出现
ERROR 1406 (22001): Data too long for column 'name' at row 1
的错误
如果使用mysql命令时加上--default-character-set=gbk 的参数,则错误排除!
$db = new medoo([
[表示数组的意思。转换成array()包含就可以了。
<?php/*
* 下面别修改
*/
//medoo
//Define DB Table Name
$db_table['user'] = "user"
//Version
$version ="2.4.5"
//set timezone
date_default_timezone_set('PRC')
//Using Mysqli
$dbc = new mysqli(DB_HOST,DB_USER,DB_PWD,DB_DBNAME)
$db_char = DB_CHARSET
$dbc->query("SET NAMES utf8")
$dbc->query("SET time_zone = '+8:00'")
//$dbinfo
$dbInfo['database_type'] = DB_TYPE
$dbInfo['database_name'] = DB_DBNAME
$dbInfo['server'] = DB_HOST
$dbInfo['username'] = DB_USER
$dbInfo['password'] = DB_PWD
$dbInfo['charset'] = DB_CHARSET
//Define system Path
$ss_path = __DIR__
$ss_path = substr($ss_path,0,strlen($ss_path)-4)
define('SS_PATH',$ss_path)
//autoload class
spl_autoload_register('autoload')
function autoload($class){
require_once SS_PATH.'/lib/'.str_replace('\\','/',$class).'.php'
}
require_once 'Ss/Ext/Medoo.php'
$db = new medoo(array(
// required
'database_type' => DB_TYPE,
'database_name' => DB_DBNAME,
'server' => DB_HOST,
'username' => DB_USER,
'password' => DB_PWD,
'charset' => DB_CHARSET,
// optional
'port' => 3306,
// driver_option for connection, read more from http://www.php.net/manual/en/pdo.setattribute.php
'option' => array(
PDO::ATTR_CASE => PDO::CASE_NATURAL
)
)
)
$Runtime= new \Ss\Etc\Runtime()
$Runtime->Start()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)