我有一个奇怪的错误。我有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/";
}
}
谢谢你的建议。
我发现了问题。这是因为没有DB的实例,因此,它采用了Live的实例。