20,397
社区成员




// 数据库连接参数配置
protected $config = [
// 数据库类型
'type' => 'mysql',
// 服务器地址
'hostname' => '127.0.0.1',
// 数据库名
'database' => 'wstmart',
// 用户名
'username' => 'root',
// 密码
'password' => 'a123456b',
// 端口
'hostport' => '3306',
// 连接dsn
'dsn' => '',
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => 'utf8',
// 数据库表前缀
'prefix' => 'cs_',
// 数据库调试模式
'debug' => true,
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 是否严格检查字段是否存在
'fields_strict' => true,
// 数据集返回类型
'resultset_type' => 'array',
// 自动写入时间戳字段
'auto_timestamp' => false,
// 是否需要进行SQL性能分析
'sql_explain' => false,
// Builder类
'builder' => '',
// Query类
'query' => '\\think\\db\\Query',
];
[8] ErrorException in Connection.php line 299
未定义数组下标: 0
} catch (\PDOException $e) {
if ($autoConnection) {
Log::record($e->getMessage(), 'error');
return $this->connect($autoConnection, $linkNum);
} else {
throw $e;
}
}
}
return $this->links[$linkNum];
}
/**
* 释放查询结果
* @access public
*/
public function free()
{
$this->PDOStatement = null;
Call Stack
in Connection.php line 299
at Error::appError(8, 'Undefined offset: 0', '/Users/andy/WebServe...', 299, ['config' => ['type' => 'mysql', 'hostname' => '127.0.0.1', 'database' => 'wstmart', ...], 'linkNum' => 0, 'autoConnection' => false, ...]) in Connection.php line 299
at Connection->connect() in Connection.php line 851
at Connection->initConnect(true) in Mysql.php line 52
at Mysql->getFields('wst_home_menus') in Query.php line 1424
at Query->getTableInfo('wst_home_menus', 'type') in Query.php line 1472
at Query->getFieldsType(['where' => ['AND' => ['dataFlag' => ['eq', 1]]], 'order' => 'menuType asc', 'table' => 'wst_home_menus', ...]) in Query.php line 1478
at Query->getFieldsBind(['where' => ['AND' => ['dataFlag' => ['eq', 1]]], 'order' => 'menuType asc', 'table' => 'wst_home_menus', ...]) in Builder.php line 230
at Builder->buildWhere(['AND' => ['dataFlag' => ['eq', 1]]], ['where' => ['AND' => ['dataFlag' => ['eq', 1]]], 'order' => 'menuType asc', 'table' => 'wst_home_menus', ...]) in Builder.php line 208
at Builder->parseWhere(['AND' => ['dataFlag' => ['eq', 1]]], ['where' => ['AND' => ['dataFlag' => ['eq', 1]]], 'order' => 'menuType asc', 'table' => 'wst_home_menus', ...]) in Builder.php line 600
at Builder->select(['where' => ['AND' => ['dataFlag' => ['eq', 1]]], 'order' => 'menuType asc', 'table' => 'wst_home_menus', ...]) in Query.php line 1932
at Query->select() in HomeMenus.php line 65
at HomeMenus->getMenusUrl() in InitConfig.php line 19
at InitConfig->run(object(Request), null) in Hook.php line 121
at Hook::exec('wstmart\home\behavio...', 'module_init', object(Request), null) in Hook.php line 92
at Hook::listen('module_init', object(Request)) in App.php line 373
at App::module(['', null, null], ['app_namespace' => 'wstmart', 'app_debug' => true, 'app_trace' => false, ...], true) in App.php line 140
at App::run() in start.php line 18
at require('/Users/andy/WebServe...') in index.php line 26
ThinkPHP V5.0.3 { 十年磨一剑-为API开发设计的高性能框架 }