我在Laravel 5.2中发现了一个奇怪的错误。 我在
中有这个代码routes.php文件
Route::get('/registeruser', 'AddClientsController@createuser');
AddClientsController.php
public function createuser()
{
return view('admin.registeruser');
}
管理员/ registeruser.blade.php
@extends('layouts.admin')
@section('content')
<span>hi</span>
@endsection
当我尝试运行http://localhost:8000/registeruser时,它会返回我
Maximum function nesting level of '100' reached, aborting!
in ConnectionInterface.php line 3
at FatalErrorException->__construct() in HandleExceptions.php line 133
at HandleExceptions->fatalExceptionFromError() in HandleExceptions.php line 118
at HandleExceptions->handleShutdown() in HandleExceptions.php line 0
at Composer\Autoload\includeFile() in ClassLoader.php line 301
at ClassLoader->loadClass() in ClassLoader.php line 0
at spl_autoload_call() in ClassLoader.php line 22
in ClassLoader.php line 412
at Composer\Autoload\includeFile() in ClassLoader.php line 301
at ClassLoader->loadClass() in ClassLoader.php line 0
at spl_autoload_call() in ClassLoader.php line 12
in ClassLoader.php line 412
at Composer\Autoload\includeFile() in ClassLoader.php line 301
at ClassLoader->loadClass() in ConnectionFactory.php line 0
at spl_autoload_call() in ConnectionFactory.php line 217
at ConnectionFactory->createConnection() in ConnectionFactory.php line 64
at ConnectionFactory->createSingleConnection() in ConnectionFactory.php line 49
at ConnectionFactory->make() in DatabaseManager.php line 176
at DatabaseManager->makeConnection() in DatabaseManager.php line 68
at DatabaseManager->connection() in Model.php line 3282
at Model::resolveConnection() in Model.php line 3248
at Model->getConnection() in Model.php line 1869
at Model->newBaseQueryBuilder() in Model.php line 1842
at Model->newQueryWithoutScopes() in Model.php line 1812
at Model->newQuery() in EloquentUserProvider.php line 47
at EloquentUserProvider->retrieveById() in SessionGuard.php line 132
at SessionGuard->user() in AuthManager.php line 292
at call_user_func_array:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Auth\AuthManager.php:292}() in AuthManager.php line 292
at AuthManager->__call() in Facade.php line 215
at AuthManager->user() in Facade.php line 215
at Facade::__callStatic() in 70064030c077ee582de1d5a52ba0cfecf1b1a602.php line 258
at Auth::user() in 70064030c077ee582de1d5a52ba0cfecf1b1a602.php line 258
in PhpEngine.php line 42
at PhpEngine->evaluatePath() in CompilerEngine.php line 59
at CompilerEngine->get() in View.php line 149
at View->getContents() in View.php line 120
at View->renderContents() in View.php line 85
at View->render() in 09b93a4ce8d91a23a9f3d4c32042f3bb28e1ac99.php line 242
in PhpEngine.php line 42
at PhpEngine->evaluatePath() in CompilerEngine.php line 59
at CompilerEngine->get() in View.php line 149
at View->getContents() in View.php line 120
at View->renderContents() in View.php line 85
at View->render() in Response.php line 53
at Response->setContent() in Response.php line 201
at Response->__construct() in Router.php line 1085
at Router->prepareResponse() in ControllerDispatcher.php line 95
at ControllerDispatcher->Illuminate\Routing\{closure}() in Pipeline.php line 52
at call_user_func:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:52}() in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}() in Pipeline.php line 103
at call_user_func:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:103}() in Pipeline.php line 103
at Pipeline->then() in ControllerDispatcher.php line 96
at ControllerDispatcher->callWithinStack() in ControllerDispatcher.php line 54
at ControllerDispatcher->dispatch() in Route.php line 174
at Route->runController() in Route.php line 140
at Route->run() in Router.php line 724
at Router->Illuminate\Routing\{closure}() in Pipeline.php line 52
at call_user_func:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:52}() in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}() in VerifyCsrfToken.php line 64
at VerifyCsrfToken->handle() in Pipeline.php line 136
at call_user_func_array:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle() in Pipeline.php line 136
at call_user_func_array:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in StartSession.php line 62
at StartSession->handle() in Pipeline.php line 136
at call_user_func_array:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle() in Pipeline.php line 136
at call_user_func_array:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in EncryptCookies.php line 59
at EncryptCookies->handle() in Pipeline.php line 136
at call_user_func_array:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in Pipeline.php line 103
at call_user_func:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:103}() in Pipeline.php line 103
at Pipeline->then() in Router.php line 726
at Router->runRouteWithinStack() in Router.php line 699
at Router->dispatchToRoute() in Router.php line 675
at Router->dispatch() in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}() in Pipeline.php line 52
at call_user_func:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:52}() in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}() in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle() in Pipeline.php line 136
at call_user_func_array:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in Pipeline.php line 103
at call_user_func:{C:\Users\Haw\Desktop\Project-EAPM\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:103}() in Pipeline.php line 103
at Pipeline->then() in Kernel.php line 132
at Kernel->sendRequestThroughRouter() in Kernel.php line 99
at Kernel->handle() in index.php line 54
in server.php line 21
at {main}() in server.php line 0
但是,当我在routes.php中执行以下更改时,它可以正常工作
Route::get('/registeruser', function(){ return view('admin.registeruser'); });
知道这里发生了什么吗?
答案 0 :(得分:0)
我遇到了同样的问题。 我通过向控制器添加auth中间件来解决它;
public function __construct()
{
$this->middleware('auth');
}