- 论坛徽章:
- 1
|
本帖最后由 hjmsolar 于 2013-09-03 00:39 编辑
- class clsDB {
- ……
-
- public function exec($pSQL = '') {
- if (!is_resource($this->Conn)) {
- $this->connect();
- }
- if (is_resource($this->Conn)) {
- if ($pSQL == '') {
- $this->Res = pg_query($this->Conn, $this->SQL);
- } else {
- $this->Res = pg_query($this->Conn, $pSQL);
- }
- return ($this->Res === false) ? false : true;
- } else {
- return false;
- }
- }
- }
- class clsSESSION {
- ……
- function read($pkey) {
- global $gDB;
- ……
- $gDB->exec('……');
- ……
-
- }
- function write($pkey, $pdata) {
- global $gDB;
- ……
- $gDB->exec('……');
- ……
- }
- }
- $gDB = new clsDB();
- $gSession = new clsSESSION();
复制代码 在$gSession::read()里面第一次运行$gDB->exec()没问题。
到在$gSession::write()里面第二次运行$gDB->exec()就出现“Fatal error: Call to undefined method stdClass::exec() in …path… on line xx ”的错误提示。
请教一下大家,这是怎么回事,如何解决。 |
|