我有两次这个错误,每次都花了将近30分钟来调试它。我希望它能帮助一些人,因为我在互联网上找到的只是关闭xDebug的解决方案。
PHP致命错误:已达到最大函数嵌套级别"100",正在中止!
发生这种情况是因为我不小心将两个类相互注入。
class Foo(Bar $bar){}
class Bar(Foo $foo){}
$bar = new Bar(new Foo(new bar(new Foo(...))));
之所以没有看到这一点,是因为拉拉威尔国际奥委会。因此,用于实例化类的synax类似于:
$bar = new Bar(Foo $foo);
问题是由默认的xdebug.max_testing_level(100)引起的。
通过将下面的行添加到Laravel 5.1 中的bootstrap/autoload.php
ini_set('xdebug.max_nesting_level', 120);
.........
define('LARAVEL_START', microtime(true));
这个回答帮助了我。
https://stackoverflow.com/a/30839127/3524046
这是我案例中的问题。
我有一个服务类,它是代码点火器中的图书馆。里面有这样的功能。
class PaymentService {
private $CI;
public function __construct() {
$this->CI =& get_instance();
}
public function procss(){
// lots of Ci referencing here ...
}
我的控制器如下:
$this->load->library('PaymentService');
$this->process_(); // see I got his wrong instead it should be like below
$this->Payment_service->process(); //the library class name
然后我不断收到超过错误信息。但我确实禁用了XDebug,但没有任何帮助。无论如何,请检查您的类名或代码是否正确调用函数。