問題
Using $this when not in object context in
解決方法
private $link_id;
private $sql;
private $getAll = array();
private $getOne = array();
private $qRes;
public static function _init(&$dsn, $pconnect = FALSE, $halt = TRUE) {
if(!is_array($dsn)) exit('Error, Dsn not is array');
$dsn['host'] = (isset($dsn['host']))?$dsn['host']:'localhost';
$dsn['login'] = (isset($dsn['login']))?$dsn['login']:'root';
$dsn['dbpwd'] = (isset($dsn['dbpwd']))?$dsn['dbpwd']:NULL;
$dsn['db'] = (isset($dsn['db']))?$dsn['db']:'test';
$dsn['char'] = (isset($dsn['char']))?str_replace('-', NULL, $dsn['char']):'utf8';
if($pconnect) {
if(!$this->link_id = @mysql_pconnect($dsn['host'], $dsn['login'], $dsn['dbpwd'])) {
$halt && $this->getErrorMsg(__LINE__);
}
} else {
if(!$this->link_id = @mysql_connect($dsn['host'], $dsn['login'], $dsn['dbpwd'])) {# 執行到這裡出錯。。
$halt && $this->getErrorMsg(__LINE__);
}
}
復制代碼
參考答案
static function 中 用 self
參考答案
靜態函數裡用self!!!!!!!!!!!!!!!
參考答案
....我現在沒用static,現在是public function 他還是報錯
參考答案
那就是沒這方法