Database Err: SQLSTATE[HY000] [2002] Connection refused

427.              try {
428.                  if (!class_exists("PDO") || !in_array("mysql"PDO::getAvailableDrivers(), true)) {
429.                      err('Database Err: PDO or PDO_MYSQL doesn\'t exist!');
430.                  }
431.                  $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'] . '\''));
432.              } catch (PDOException $e) {err('Database Err: ' $e->getMessage());}
433.          }
434.          return $GLOBALS['mysql_instances'][$db_config_key];
435.      }
436. 
437.      private function _where($conditions) {
394. 
395.          if ($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])) {
396.              $slave_key array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
397.              $sth $this->dbInstance($GLOBALS['mysql']['MYSQL_SLAVE'][$slave_key], 'slave_' $slave_key)->prepare($sql);
398.          } else {
399.              $sth $this->dbInstance($GLOBALS['mysql'], 'master')->prepare($sql);
400.          }
401. 
402.          if (is_array($params) && !empty($params)) {
403.              foreach ($params as $k => &$v) {
404.                  if (is_int($v)) {
386.              }
387.          }
388.          return $this->page;
389.      }
390. 
391.      public function query($sql$params = array()) {return $this->execute($sql$paramstrue);}
392.      public function execute($sql$params = array(), $readonly false) {
393.          $this->sql[] = $sql;
394. 
395.          if ($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])) {
396.              $slave_key array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
299.              $limit $this->pager($limit[0], $limit[1], $limit[2], $total[0]['M_COUNTER']);
300.              $limit = empty($limit) ? '' ' LIMIT ' $limit['offset'] . ',' $limit['limit'];
301.          } else {
302.              $limit = !empty($limit) ? ' LIMIT ' $limit '';
303.          }
304.          return $this->query('SELECT ' $fields $sql $sort $limit$conditions["_bindParams"]);
305.      }
306. 
307.      public function find($conditions = array(), $sort null$fields '*') {
308.          $res $this->findAll($conditions$sort$fields1);
309.          return !empty($res) ? array_pop($res) : false;
2.  class BaseController extends Controller {
3.      //public $layout = "layout.html";
4.      //获取系统配置信息
5.      function Conf() {
6.          $Config = new Config();
7.          $Config $Config->findAll(); //获取系统配置
8.          $this->conf = array();
9.          foreach ($Config as $crow) {
10.              //print_r($v);
11.              $this->conf[$crow['k']] = $crow['v'];
12.          }
204.          exit(json_encode($result));
205.      }
206. 
207.      //本平台条款
208.      function actionTerm() {
209.          $this->conf(); //引入变量 系统配置
210.          $this->display($this->conf['Uui_Template']."/Term.html");
211.      }
212. 
213.      //注册邮件发送
214.      function actionSendEmilTest() {
122.  if (!method_exists($controller_name$action_name)) {
123.      _err_router("Err: Method '$action_name' of '$controller_name' is not exists!");
124.  }
125. 
126.  $controller_obj = new $controller_name();
127.  $controller_obj->$action_name();
128. 
129.  if ($controller_obj->_auto_display) {
130.      $auto_tpl_name = (empty($__module) ? '' $__module DS) . $__controller '_' $__action '.html';
131.      if (file_exists(APP_DIR DS 'protected' DS 'view' DS $auto_tpl_name)) {
132.          $controller_obj->display($auto_tpl_name);
40.  if($_GET['runcron']){
41.      //云端防止监控自动停止
42.      $ch curl_init();curl_setopt($chCURLOPT_URL, ((int)$_SERVER['SERVER_PORT'] == 80 'http://'.$_SERVER['HTTP_HOST'] : 'https://'.$_SERVER['HTTP_HOST']).'/Crontab/Tim/Run?r='.time());curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);curl_setopt($chCURLOPT_SSL_VERIFYHOSTfalse);curl_setopt($chCURLOPT_RETURNTRANSFER1);curl_setopt($chCURLOPT_FOLLOWLOCATION1);curl_setopt($chCURLOPT_TIMEOUT1);curl_exec($ch);curl_close($ch);
43.      exit('站点正常哦');
44.  }
45.  require(APP_DIR.'/protected/lib/speed.php');