Problem
Using $ this when not in object context in
Solution
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']) {# An error occurred while executing ..
$ Halt & $ this-> getErrorMsg (_ LINE __);
}
}
Copy code
Reference answer
Use self in static function
Reference answer
Use self! In static functions !!!!!!!!!!!!!!!
Reference answer
... I am not using static now. If it is a public function, it still reports an error.
Reference answer
That's not the case.