hab ein Problem bei PHP im Objektorienterten Bereich.
index.php
PHP Code:
require_once('cms.class.php');
$cms = new cms();
PHP Code:
class cms {
private $time;
private static $page;
private static $user;
private static $db;
public function __construct() {
$this->setDB();
$this->setPage();
$this->setUser();
$this->time = time();
$this->validateForms();
}
/*
* Information about Page
*/
private function setPage() {
self::$page = new page();
}
public static function getPage() {
return self::$page;
}
/*
* Information about User
*/
private function setUser() {
self::$user = new user();
}
public static function getUser() {
return self::$user;
}
/*
* Information about Database
*/
private function setDB() {
self::$db = new db();
}
public static function getDB() {
return self::$db;
}
}
PHP Code:
class page {
private $templateDir = "templates/";
private $pageDir = "pages/";
private $pageName;
public function __construct() {
$this->setPage();
$this->setTemplate();
echo cms::getUser()->getUsers();
}
}
Code:
Fatal error: Call to a member function getUsers() on a non-object in C:\xampp\htdocs\lib\page\page.class.php on line 16






