Database Err: SQLSTATE[HY000] [1040] Too many connections
- /home/wwwroot/www.zhanghelove.vip/wlb/lib/speed.php on line 361
356.
}
357.
public function dbInstance($db_config, $db_config_key, $force_replace = false){
358.
if($force_replace || empty($GLOBALS['mysql_instances'][$db_config_key])){
359.
try {
360.
$GLOBALS['mysql_instances'][$db_config_key] = new PDO('mysql:dbname='.$db_config['MYSQL_DB'].';host='.$db_config['MYSQL_HOST'].';port='.$db_config['MYSQL_PORT'], $db_config['MYSQL_USER'], $db_config['MYSQL_PASS'], array(PDO::MYSQL_ATTR_INIT_COMMAND=>'SET NAMES \''.$db_config['MYSQL_CHARSET'].'\''));
361.
362.
}catch(PDOException $e){err('Database Err: '.$e->getMessage());}
}
363.
return $GLOBALS['mysql_instances'][$db_config_key];
364.
}
365.
private function _where($conditions){
366.
$result = array( "_where" => " ","_bindParams" => array());
- /home/wwwroot/www.zhanghelove.vip/wlb/lib/speed.php on line 348
343.
$this->sql[] = $sql;
344.
if($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])){
345.
$slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
346.
$sth = $this->dbInstance($GLOBALS['mysql']['MYSQL_SLAVE'][$slave_key], 'slave_'.$slave_key)->prepare($sql);
347.
}else{
348.
349.
$sth = $this->dbInstance($GLOBALS['mysql'], 'master')->prepare($sql);
}
350.
if(is_array($params) && !empty($params)){
351.
foreach($params as $k=>&$v) $sth->bindParam($k, $v);
352.
}
353.
if($sth->execute())return $readonly ? $sth->fetchAll(PDO::FETCH_ASSOC) : $sth->rowCount();
- /home/wwwroot/www.zhanghelove.vip/wlb/lib/speed.php on line 341
336.
$this->page['all_pages'] = range($total_page-$scope+1, $total_page);
337.
}
338.
}
339.
return $this->page;
340.
}
341.
342.
public function query($sql, $params = array()){return $this->execute($sql, $params, true);}
public function execute($sql, $params = array(), $readonly = false){
343.
$this->sql[] = $sql;
344.
if($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])){
345.
$slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
346.
$sth = $this->dbInstance($GLOBALS['mysql']['MYSQL_SLAVE'][$slave_key], 'slave_'.$slave_key)->prepare($sql);
- /home/wwwroot/www.zhanghelove.vip/wlb/lib/speed.php on line 260
255.
$limit = $this->pager($limit[0], $limit[1], $limit[2], $total[0]['M_COUNTER']);
256.
$limit = empty($limit) ? '' : ' LIMIT '.$limit['offset'].','.$limit['limit'];
257.
}else{
258.
$limit = !empty($limit) ? ' LIMIT '.$limit : '';
259.
}
260.
261.
return $this->query('SELECT '. $fields . $sql . $sort . $limit, $conditions["_bindParams"]);
}
262.
public function find($conditions = array(), $sort = null, $fields = '*'){
263.
$res = $this->findAll($conditions, $sort, $fields, 1);
264.
return !empty($res) ? array_pop($res) : false;
265.
}
- /home/wwwroot/www.zhanghelove.vip/wlb/lib/speed.php on line 263
258.
$limit = !empty($limit) ? ' LIMIT '.$limit : '';
259.
}
260.
return $this->query('SELECT '. $fields . $sql . $sort . $limit, $conditions["_bindParams"]);
261.
}
262.
public function find($conditions = array(), $sort = null, $fields = '*'){
263.
264.
$res = $this->findAll($conditions, $sort, $fields, 1);
return !empty($res) ? array_pop($res) : false;
265.
}
266.
public function findfield($conditions = array(), $sort = null, $fields = '*'){
267.
$res = $this->find($conditions, $sort, $fields);
268.
return !empty($res) ? $res[$fields] : false;
- /home/wwwroot/www.zhanghelove.vip/wlb/functions/sql.php on line 84
79.
$row=$obj->find($param,$sort,$title);
80.
S($sqlstr,$row,CACHE_TIME,$path);
81.
return $row;
82.
}
83.
}else{
84.
85.
$row=$obj->find($param,$sort,$title);
return $row;
86.
}
87.
}
88.
/**
89.
* 根据条件返回sql记录
- /home/wwwroot/www.zhanghelove.vip/addons/news/controller/CompController.php on line 8
3.
4.
function _init(){
5.
/*if(isMobile()){
6.
header('location:'.url('news/wap','index'));exit;
7.
}*/
8.
9.
$sys=get_model_one(null, 'news_sys','*');
$webconfig=json_decode($sys['webconfig'],true);
10.
$this->path='/addons/news/view/comp/'.$webconfig['modelcomp'];
11.
$this->subpath='comp/'.$webconfig['modelcomp'];
12.
$this->catelist=get_model_other(array('is_view'), 'news_cate','id,title,pid');
13.
$this->sys=$sys;
- /home/wwwroot/www.zhanghelove.vip/wlb/lib/speed.php on line 216
211.
212.
}
213.
public function __construct(){
214.
$this->init();
215.
/* 简介构造方法 */
216.
217.
if(method_exists($this,'_init')){$this->_init();}
}
218.
public function __get($name){return $this->_data[$name];}
219.
public function __set($name, $value){$this->_data[$name] = $value;}
220.
public function display($tpl_name='', $return = false){
221.
if($tpl_name==''){$tpl_name=$this->ca.'.html';};
- /home/wwwroot/www.zhanghelove.vip/wlb/lib/speed.php on line 116
111.
$str="Err: Method '$action_name ' of '$controller_name' is not exists!";
112.
}
113.
BaseController::err404($str);
114.
}
115.
}
116.
117.
$controller_obj = new $controller_name();
$controller_obj->$action_name();
118.
119.
120.
if($controller_obj->_auto_display){
121.
$auto_tpl_dir = (empty($__module) ? 'wlb'. DS.'view' : ADDONS.DS.$__module.DS.'view');
- /home/wwwroot/www.zhanghelove.vip/index.php on line 12
7.
define('APP_DIR', realpath('./'));
8.
define ('SITE_DOMAIN', strip_tags ( $_SERVER ['HTTP_HOST'] ) );
9.
define ('SITE_PATH', dirname ( __FILE__ ) );
10.
define('SYSNAME', "逆境磨砺德行");
11.
define('IN',true);
12.
require(APP_DIR.'/wlb/lib/speed.php');