致命错误:达到“100”的最大函数嵌套级别,正在中止!在第 4 行的 C:\wamp\www\int\system\core\Controller.php
Call Stack
# Time Memory Function Location
1 0.0004 364608 {main}( ) ..\index.php:0
2 1.0350 433152 Bootstrap->__construct( ) ..\index.php:11
3 1.0355 438536 Welcome->__construct( ) ..\Bootstrap.php:7
4 1.0355 438536 Controller->__construct( ) ..\welcome.php:4
5 1.0356 438680 View->__construct( ) ..\Controller.php:4
6 1.0356 438680 Controller->__construct( ) ..\View.php:4
错误行:
<?php
class Controller {
function __construct() {
$this->view = new View(); // Error starts here
$this->model = new Model();
$this->tpl = new Template();
$this->input = new Input();
$this->lib = new Library();
$this->session = new Session();
}
}
?>
我将如何解决这个问题?我尝试扩展最大嵌套级别,但每次我将其增加到 200 时,它都会说致命错误达到了 200 的最大级别,正在中止!
更新:已修复:)
public function __construct() {
self::$instance =& $this;
$this->view = new View;
$this->model = new Model;
$this->tpl = new Template;
$this->input = new Input;
$this->lib = new Library;
$this->session = new Session;
}
public static function &get_instance() {
return self::$instance;
}
在模型中:
function __get($key)
{
$fw =& Controller::get_instance();
return $fw->$key;
}