用tp用习惯了,创建视图的时候 直接创建成index.html了。。。。{{$name}}也不被解析。。。仔细一瞅哎。
laravel中创建视图:
resources\views下创建
视图文件名:fileName.blade.php格式 如:index.blade.php
csrf保护:
在视图创建表单的时候需要设置 csrf 否则就会 报419错误
<form action="/index/show/123" enctype="multipart/form-data" method="post" accept-charset="utf-8">
@csrf
<!-- {{ csrf_field() }} -->
<!-- <input type="hidden" name="_token" value="{{ csrf_token() }}"> -->
<input type="file" name="file">
<input type="submit" >
</form> 共三种方法:
第一种:@csrf
第二种:{{ csrf_field() }}
第三种:<input type="hidden" name="_token" value="{{ csrf_token() }}">
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号