简体   繁体   English

Laravel Blade View - 未定义的变量:错误

[英]Laravel Blade View - Undefined variable: errors

When accessing the login page of my laravel application I get a Undefined variable: errors (View: D:\\PhpstormProjects\\laravel\\resources\\views\\login.blade.php) error. 当访问我的laravel应用程序的登录页面时,我得到一个Undefined variable: errors (View: D:\\PhpstormProjects\\laravel\\resources\\views\\login.blade.php)错误。

According to http://laravel.com/docs/master/validation#error-messages-and-views , $errors should always automatically be set: 根据http://laravel.com/docs/master/validation#error-messages-and-views ,应始终自动设置$ errors:

So, it is important to note that an $errors variable will always be available in all of your views, on every request , allowing you to conveniently assume the $errors variable is always defined and can be safely used. 因此,重要的是要注意,在每个请求中所有视图中都会始终提供$ errors变量 ,从而可以方便地假设$ errors变量始终定义并且可以安全使用。

This is the blade file: 这是刀片文件:

@extends('layouts.master')

@section('main')
<div id="loginwrapper">
    <h2>Please authenticate</h2>
    @if ($errors->has())
        <div id="error">
            {{ $errors->first() }}
        </div>
    @endif
    {!! Form::open(['id' => 'loginform', 'name' => 'loginform']) !!}
    ... Form stuff ...
    {!! Form::close() !!}
</div>
@stop

The view is being generated by a simple View::make('login'); 该视图由一个简单的View::make('login'); I am using the laravel 5.0 development version. 我正在使用laravel 5.0开发版。

Does anyone know the reason for this? 有谁知道这个的原因?

这是框架中的一个错误,今天就修好了: https//github.com/laravel/laravel/commit/a9bddfc0e0573aa2b6d9d553126e9bf0af064e7b

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM