回答編集履歴
1
BladeテンプレートにCSRF()追加
test
CHANGED
@@ -15,3 +15,51 @@
|
|
15
15
|
Route::post('/helo', 'HeloController@postIndex');
|
16
16
|
|
17
17
|
```
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
**== 追記 ==**
|
22
|
+
|
23
|
+
**resources/views/helo.blade.php** (Bladeに`{{ csrf_field() }}`を入れる)
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
```php
|
28
|
+
|
29
|
+
<!doctype html>
|
30
|
+
|
31
|
+
<html>
|
32
|
+
|
33
|
+
<head>
|
34
|
+
|
35
|
+
<title>Sample</title>
|
36
|
+
|
37
|
+
<style>
|
38
|
+
|
39
|
+
body { color:gray; }
|
40
|
+
|
41
|
+
h1 { font-size:18pt; font-weight:bold; }
|
42
|
+
|
43
|
+
</style>
|
44
|
+
|
45
|
+
</head>
|
46
|
+
|
47
|
+
<body>
|
48
|
+
|
49
|
+
<h1>Sample</h1>
|
50
|
+
|
51
|
+
<p><?php echo $message; ?></p>
|
52
|
+
|
53
|
+
<form method="post" action="/helo">
|
54
|
+
|
55
|
+
{{ csrf_field() }}
|
56
|
+
|
57
|
+
<input type="text" name="str">
|
58
|
+
|
59
|
+
<input type="submit">
|
60
|
+
|
61
|
+
</form>
|
62
|
+
|
63
|
+
</body>
|
64
|
+
|
65
|
+
```
|