NOTICE: Undefined index: MYSQL_DB in /data1/www/htdocs/569/speedphp/1/protected/lib/speed.php on line 329
- /data1/www/htdocs/569/speedphp/1/protected/lib/speed.php on line 495
490.
$msg = "ERROR";
491.
if($errno == E_WARNING)$msg = "WARNING";
492.
if($errno == E_NOTICE)$msg = "NOTICE";
493.
if($errno == E_STRICT)$msg = "STRICT";
494.
if($errno == 8192)$msg = "DEPRECATED";
495.
496.
err("$msg: $errstr in $errfile on line $errline");
}
497.
function err($msg){
498.
$msg = htmlspecialchars($msg);
499.
$traces = debug_backtrace();
500.
if(!$GLOBALS['debug']){
- /data1/www/htdocs/569/speedphp/1/protected/lib/speed.php on line 329
324.
}
325.
326.
public function dbInstance($db_config, $db_config_key, $force_replace = false){
327.
if($force_replace || empty($GLOBALS['mysql_instances'][$db_config_key])){
328.
try {
329.
330.
$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'].'\''));
}catch(PDOException $e){err('Database Err: '.$e->getMessage());}
331.
}
332.
return $GLOBALS['mysql_instances'][$db_config_key];
333.
}
334.
- /data1/www/htdocs/569/speedphp/1/protected/lib/speed.php on line 303
298.
299.
if($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])){
300.
$slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
301.
$sth = $this->dbInstance($GLOBALS['mysql']['MYSQL_SLAVE'][$slave_key], 'slave_'.$slave_key)->prepare($sql);
302.
}else{
303.
304.
$sth = $this->dbInstance($GLOBALS['mysql'], 'master')->prepare($sql);
}
305.
306.
if(is_array($params) && !empty($params)){
307.
foreach($params as $k => &$v){
308.
if(is_int($v)){
- /data1/www/htdocs/569/speedphp/1/protected/lib/speed.php on line 295
290.
}
291.
}
292.
return $this->page;
293.
}
294.
295.
296.
public function query($sql, $params = array()){return $this->execute($sql, $params, true);}
public function execute($sql, $params = array(), $readonly = false){
297.
$this->sql[] = $sql;
298.
299.
if($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])){
300.
$slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
- /data1/www/htdocs/569/speedphp/1/protected/lib/speed.php on line 216
211.
$limit = $this->pager($limit[0], $limit[1], $limit[2], $total[0]['M_COUNTER']);
212.
$limit = empty($limit) ? '' : ' LIMIT '.$limit['offset'].','.$limit['limit'];
213.
}else{
214.
$limit = !empty($limit) ? ' LIMIT '.$limit : '';
215.
}
216.
217.
return $this->query('SELECT '. $fields . $sql . $sort . $limit, $conditions["_bindParams"]);
}
218.
219.
public function find($conditions = array(), $sort = null, $fields = '*'){
220.
$res = $this->findAll($conditions, $sort, $fields, 1);
221.
return !empty($res) ? array_pop($res) : false;
- /data1/www/htdocs/569/speedphp/1/protected/lib/speed.php on line 220
215.
}
216.
return $this->query('SELECT '. $fields . $sql . $sort . $limit, $conditions["_bindParams"]);
217.
}
218.
219.
public function find($conditions = array(), $sort = null, $fields = '*'){
220.
221.
$res = $this->findAll($conditions, $sort, $fields, 1);
return !empty($res) ? array_pop($res) : false;
222.
}
223.
224.
public function update($conditions, $row){
225.
$values = array();
- /data1/www/htdocs/569/speedphp/1/protected/controller/DbController.php on line 54
49.
50.
// 查找findAll/find
51.
function actionFind(){
52.
$user = new User();
53.
// 先查一条,uid为2的
54.
55.
$this->findone = $user->find(array("uid"=>"2"));
56.
// 查全部,用findAll
57.
// findAll( $conditions=array(), $order=null, $field='*', $limit=null )
58.
// findAll参数:$conditions数组形式的条件(同find),$field指定字段(默认是*),
59.
// $order是排序(如 “uid DESC”), $limit是限定条数(如“3,5”,第三条开始取五条)
- /data1/www/htdocs/569/speedphp/1/protected/lib/speed.php on line 80
75.
if(!is_available_classname($__controller))_err_router("Err: Controller '$controller_name' is not correct!");
76.
if(!class_exists($controller_name, true))_err_router("Err: Controller '$controller_name' is not exists!");
77.
if(!method_exists($controller_name, $action_name))_err_router("Err: Method '$action_name' of '$controller_name' is not exists!");
78.
79.
$controller_obj = new $controller_name();
80.
81.
$controller_obj->$action_name();
82.
if($controller_obj->_auto_display){
83.
$auto_tpl_name = (empty($__module) ? '' : $__module.DS).$__controller.'_'.$__action.'.html';
84.
if(file_exists(APP_DIR.DS.'protected'.DS.'view'.DS.$auto_tpl_name))$controller_obj->display($auto_tpl_name);
85.
}
- /data1/www/htdocs/569/speedphp/1/index.php on line 3
1.
<?php
2.
define('APP_DIR', realpath('./'));
3.
require(APP_DIR.'/protected/lib/speed.php');