2015-06-21 78 views
1

我有這個奇怪的錯誤。 我有DB類和Live類。 Live類不擴展DB類。 我不明白爲什麼當我宣佈新生活發生。 的錯誤是:聲明新類時致命錯誤的方法

Notice: Undefined property: Live::$isOff in /home/main/Database/DB.class.php on line 570 

Fatal error: Call to undefined method Live::Query() in /home/main/Database/DB.class.php on line 574 

這就是我得到了這條線:

ON DB.Class.php

public function setCharset($charset) { 
    if (self::$isOff){ 
     return false; 
    } 
    self::$charset = $charset; 
    self::Query("SET NAMES '".$charset."'"); 
    return self; 
} 

ON Live.Class.php

class Live 
{ 

    protected $PaypalLogo = ''; 

    protected $isQA = null; 
    protected $siteURL = null; 

    public function __construct() { 

    DB::setCharset("utf8");//Setting charset here and that is gives Fatal Error. 

    if (strstr($_SERVER['SERVER_NAME'], "ba.")) { 
     $this->isQA = true; 
     $this->siteURL = "http://ba.live.com"; 

    } 
    else { 

     $this->isQA = false; 
     $this->siteURL = "http://www.live.com/"; 
    } 
    } 

Th向你提出任何建議。

+0

「Live」中沒有定義屬性或方法 – PiranhaGeorge

+0

沒有Live類中沒有方法和沒有屬性 – Victorino

+0

請發佈完整db – PiranhaGeorge

回答

0

我發現了這個問題。這是因爲沒有數據庫實例,正因爲如此,它是以Live爲例。

相關問題