gpt4 book ai didi

php - Laravel Blade View - undefined variable : errors

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:41:20 25 4
gpt4 key购买 nike

当访问我的 laravel 应用程序的登录页面时,我得到一个 Undefined variable: errors (View: D:\PhpstormProjects\laravel\resources\views\login.blade.php)错误。

根据 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.

这是 Blade 文件:

@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

View 是由一个简单的 View::make('login'); 生成的我使用的是 laravel 5.0 开发版。

有人知道这是什么原因吗?

最佳答案

关于php - Laravel Blade View - undefined variable : errors,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26371071/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com