PHP致命错误:最大函数嵌套级别为';100';到达,中止!在拉维尔
我有两次这个错误,每次都花了将近30分钟来调试它。我希望它能对某些人有所帮助,因为我在互联网上找到的只是关闭xDebug的解决方案 PHP致命错误:已达到最大函数嵌套级别“100”,正在中止PHP致命错误:最大函数嵌套级别为';100';到达,中止!在拉维尔,php,laravel,Php,Laravel,我有两次这个错误,每次都花了将近30分钟来调试它。我希望它能对某些人有所帮助,因为我在互联网上找到的只是关闭xDebug的解决方案 PHP致命错误:已达到最大函数嵌套级别“100”,正在中止 这发生在我身上,因为我不小心将两个类相互注入 class Foo(Bar $bar){} class Bar(Foo $foo){} $bar = new Bar(new Foo(new bar(new Foo(...)))); 之所以没有看到这一点,是因为拉雷维尔国际奥委会。因此,用于实例化类的s
这发生在我身上,因为我不小心将两个类相互注入
class Foo(Bar $bar){}
class Bar(Foo $foo){}
$bar = new Bar(new Foo(new bar(new Foo(...))));
之所以没有看到这一点,是因为拉雷维尔国际奥委会。因此,用于实例化类的synax类似于:
$bar = new Bar(Foo $foo);
这就是我的问题所在 我有一个服务类是codeigniter中的Library。里面有这样一个函数
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,但没有帮助。无论如何,请检查您的类名或代码是否正确调用函数。问题是由默认的xdebug.max\u嵌套级别(100)引起的 通过将下面的行添加到Laravel 5.1中的bootstrap/autoload.php
ini_set('xdebug.max_nesting_level', 120);
.........
define('LARAVEL_START', microtime(true));
这个回答帮助了我
这听起来更像是一个“我也是”的评论,而不是问题的实际答案。