我已经在laravel docs Laravel custom http docs中记录的views / errors目录中创建了一个名为404.blade.php的自定义视图,但是当我包含一个主模板时,它会抛出一个ErrorException。如果我从错误视图中删除@extends(' master')并只使用自定义html,则可以找到。有没有办法在我的错误视图中扩展或包含主模板?
这是我的堆栈跟踪。
ErrorException in 6d81dce21d9f786092d4f08b2291187254557680.php line 41:
Trying to get property of non-object (View C:\xampp\htdocs\auto_responder\resources\views\layouts\site_master.blade.php) (View: C:\xampp\htdocs\auto_responder\resources\views\layouts\site_master.blade.php)
in 6d81dce21d9f786092d4f08b2291187254557680.php line 41
at CompilerEngine->handleViewException(object(ErrorException), '1') in PhpEngine.php line 44
at PhpEngine->evaluatePath('C:\xampp\htdocs\auto_responder\storage\framework\views/a853a92ee6 c1570e0a223b96c01698d12a46f009.php', array('__env' => object(Factory), 'app' => object(Application), 'exception' => object(NotFoundHttpException))) in CompilerEngine.php line 59
at CompilerEngine->get('C:\xampp\htdocs\auto_responder\resources\views/errors/404.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'exception' => object(NotFoundHttpException))) 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(object(View)) in Response.php line 201
at Response->__construct(object(View), '404', array()) in ResponseFactory.php line 57
at ResponseFactory->make(object(View), '404', array()) in ResponseFactory.php line 71
at ResponseFactory->view('errors.404', array('exception' => object(NotFoundHttpException)), '404', array()) in Handler.php line 156
at Handler->renderHttpException(object(NotFoundHttpException)) in Handler.php line 113
at Handler->render(object(Request), object(NotFoundHttpException)) in Handler.php line 48
at Handler->render(object(Request), object(NotFoundHttpException)) in Pipeline.php line 80
at Pipeline->handleException(object(Request), object(NotFoundHttpException)) in Pipeline.php line 54
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 54
所以我想我的问题是,这是假设是这样,还是我做错了什么。我使用完全相同的语法来扩展所有其他视图。