我从调度程序类执行以下类,但 class_exists 和 call_user_func 都不执行该类, __controller 永远不会运行。会话没有开始。目前,作为解决方法,我$i = new Admin();
在类减速之前添加,以便在加载页面时激活类。但这种行为对我来说很奇怪。
从调度程序类中提取:
include $this->file;
if (class_exists($this->controller, TRUE)) {
if (!is_callable($this->controller, $this->action)) {
header('Location: /404.php');
exit;
}
call_user_func(array ($this->controller, $this->action), $this->route->values);
}
<?php
class Admin
{
public function __construct()
{
S::V()->title()->set('Admin');
if (!isset($_SESSION))
session_start();
if (!isset($_SESSION['auth']))
header('Location: /cp/login');
}
public function lobby($args)
{
S::V()->title()->append(' Logger');
if (isset($_REQUEST['clear'])) {
S::L()->clear();
}
$data['raw'] = S::Logger()->gethtml('20');
S::V()->addData($data);
echo S::V()->fetch('admin.php', $data);
}
?>