系统出现异常

异常位置: FILE: /www/wwwroot/www.popify.com/cn/coolphp/db.php LINE: 14

[ 提示信息 ]

Can not connect to MySQL server localhost with error: 1045:Access denied for user 'popifycn_dba'@'localhost' (using password: YES)

[ 详情 ]

请求网址:/cn/index.php
12: */
13:
14: abstract class Db{ public $adapter; public $dbType; public $config = array(); public $isMaster = false; public $isDebug = true; public $sql; public $conn; public $queryRs; public $queryTime = 0; public $readTime = 0; public $writeTime = 0; public $transTimes = 0; public $resultType = 0; public $debug = false; public static function getInstance(){ static $db = null; if( $db==null ){ if(func_num_args()>0){ $args = func_get_args(); $config = $args[0]; }elseif(file_exists(c('database_config'))){ $config = include(c('database_config')); } if( $config['adapter'] ){ $db = DB::factory($config); }else{ throw new CLException('DBException',__('system.db_config_load_failed')); } } return $db; } public static function factory( $config, $adapter=null){ $adapter = $adapter ? $adapter : ucwords(strtolower( $config['adapter'] )); $adapterClassName = $adapter.'Adapter'; if( import('corex/db/'.$adapterClassName) && class_exists($adapterClassName) ){ return new $adapterClassName( $config ); } throw new CLException('DBException',__('system.db_adapter_not_found',$adapter)); } function __construct($config){ $this->config = $config; $this->connect(); $this->isMaster = $config['is_master']==true ? true : false; $this->debug = $config['debug'] ? true : false; } public function query($sql){ if ( !$this->conn ) return false; $this->sql = $sql; if ( $this->queryRs )$this->free(); $start = microtime(TRUE); $this->_query($sql); $this->queryTime++; $end = microtime(TRUE); if($this->queryRs===false){ if( $this->debug ){ throw new CLException( 'SqlQuery',$sql,$this->error() ); }else{ $log = __( 'system.sql_query_error',$sql,$this->error() ); $this->log( $log ); return false; } } $time = $end-$start; $this->log($time); return true; } public function getDbTables($dbName=''){ if(!empty($dbName)) { $sql = 'SHOW TABLES FROM '.$dbName; }else{ $sql = 'SHOW TABLES '; } $this->query( $sql ); $result = $this->getAll(); $info = array(); foreach ($result as $key => $val) { $info[$key] = current($val); } return $info; } public function getTableFields($tableName){ if(empty($tableName)) return null; $this->query('SHOW COLUMNS FROM '.$tableName); $result = $this->getAll(); $info = array(); if($result) { foreach ($result as $key => $val) { if(is_object($val)) $val = get_object_vars($val); $info[$val['Field']] = array( 'name' => $val['Field'], 'type' => $val['Type'], 'notnull' => $val['Null'] == 'NO' ? 1 : 0, 'default' => $val['Default'], 'primary' => (strtolower($val['Key']) == 'pri'), 'autoinc' => (strtolower($val['Extra']) == 'auto_increment'), ); } } return $info; } public function getQueryCache($cacheId=null){ $cacheId = $cacheId ? $cacheId : $this->sql; if( $cacheId ){ $cache = Cache::getInstance(); $rs = $cache->get($cacheId); if($rs!==false){ return $rs; } } return false; } public function saveQueryCache($result,$expires=30,$cacheId=null){ if($expires>0){ $cacheId = $cacheId ? $cacheId : $this->sql; $cache = Cache::getInstance(); if($cache->set( $cacheId,$result,$expires )){ return true; } } return false; } public function startTransaction(){ return; } public function commit(){ return true; } public function rollback(){ return true; } public function getAll(){ $list = array(); if( $this->numRows() >0 ) { while( $row = $this->fetchRs() ){ $list[] = $row; } } return $list; } abstract function connect($config=array()); abstract function selectDB($db); abstract function fetchRs(); abstract function getOne($seek=0); abstract function error(); abstract function affectedRows(); abstract function numRows(); abstract function numFields(); abstract function insertID(); abstract function free(); abstract function version(); abstract function close(); protected abstract function _query($sql); protected function log($string) { if(!is_string($string)){ $sql = str_replace("\n", '', $this->sql); $string = "Query SQL:" . $sql . "\nUse time:" . number_format($string, 5); } Loger :: log($string, Loger :: LOG); } public function __destruct() { $this->close(); } public function getDbType(){ $dbType = $this->dbType; if(!$dbType){ $dbType = $this->adapter; } return strtolower($dbType); } } ?>15:16:

CoolPHP 1.0 { 欢迎使用CoolPHP MVC开发架构 } -- [ It being cool... ]