问题
Please, help me to find what is going on. I just set up a basic Laravel project. It's a new fresh Laravel project (5.2.29)
This is route.php
Route::get('/', 'TestController@index');
This is the test controller
class TestController extends Controller
{
public function index()
{
return view('home');
}
}
The home.blade.php is the one that comes with a fresh Laravel installation, the one printing "Laravel 5".
When I add the 'web' middleware, as following
Route::group(['middleware' => ['web']], function () {
Route::get('/', 'TestController@index');
});
I get this error: "Maximum function nesting level of '100' reached, aborting!". I read some thread about xDebug, so i add this line to xdebug.ini
xdebug.max_nesting_level = 1000
but nothing changed.
Any help? Or any suggestion on what else could I check? Thank you
回答1:
Try to remove web
middleware, because now it applies automatically to all routes. So, since v5.2.27 you do not need to apply web
middleware to avoid errors.
回答2:
If you installed new application (5.2.27 at the moment of installation), you don't have to use web
middleware group because it will be automatically applied, however if you installed version prior to 5.2.27 and then updated to 5.2.27 or later you still need to use it.
So first you need to verify app/Providers/RouteServiceProvider.php
if there's web middleware group automatically applied. If yes, you should remove it from routes.php
because you might get unexpected behaviour.
If it's not the case, you should verify what Middleware are included into web
middleware group because some of them might cause problems
来源:https://stackoverflow.com/questions/36579389/laravel-5-2-maximum-function-nesting-level