2016-07-05 49 views
0

在我的app.blade.php基本模板中,我做了一個簡單的檢查,看看用戶是否登錄。它看起來像這樣:Laravel 5.2 with Sentinel 2 - 最大功能嵌套級別達到'100',正在中止

@if (Sentinel::check()) 
    <li><a href="members.aspx">Members</a></li> 
@else 
    <li><a href="{{ url('/login') }}">Login</a></li> 
    <li><a href="{{ url('/register') }}">Register</a></li> 
@endif 

這會觸發Maximum function nesting level of '100' reached, aborting。任何想法爲什麼。我在app.php中正確定義了提供者和門面。像這樣:

'providers' => [ 
    .... 
    Cartalyst\Sentinel\Laravel\SentinelServiceProvider::class, 
    .... 
], 

'aliases' => [ 
    .... 
    'Sentinel' => Cartalyst\Sentinel\Laravel\Facades\Sentinel::class, 
    .... 
], 

回答

1

雖然我不能說爲什麼你得到這個錯誤,我可以告訴你如何解決它;您需要在您的php.ini中編輯您的xdebug.max_nesting_level

通常將其設置爲200或300會有訣竅,並且通常只是您使用xdebug的本地開發中的一個問題。

你可以這樣設置; xdebug.max_nesting_level=200xdebug.max_nesting_level=300

有關此設置的更多信息請參見docs for xdebug。

+0

我通常不喜歡那些屬性,因爲我通常認爲存在更大的問題。然而,這似乎確實爲這個例子伎倆。也許這只是一個低效率的功能。謝謝。 – LoneWolfPR

相關問題