質問編集履歴

1

コードのテキスト化を修正しました。

2019/11/11 05:11

投稿

twinparadox
twinparadox

スコア42

test CHANGED
File without changes
test CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
 
28
28
 
29
- 以下エラー内容とソースコード画像を添付致します。
29
+ 以下エラー内容画像とソースコードを添付致します。
30
30
 
31
31
 
32
32
 
@@ -34,8 +34,178 @@
34
34
 
35
35
  ![エラー画像2](382a5313e468cf179c85d413cc6fcff9.png)
36
36
 
37
-
37
+ > index.blade.php
38
+
38
-
39
+ ```index.blade.php
40
+
41
+ <html>
42
+
43
+
44
+
45
+ <head>
46
+
47
+ <title>Hello/Index</title>
48
+
49
+ <style>
50
+
51
+ body {
52
+
53
+ font-size: 16pt;
54
+
55
+ color: #999;
56
+
57
+ }
58
+
59
+
60
+
61
+ h1 {
62
+
63
+ font-size: 50pt;
64
+
65
+ text-align: right;
66
+
67
+ color: #f6f6f6;
68
+
69
+ margin: -20px 0px -30px 0px;
70
+
71
+ letter-spacing: -4pt;
72
+
73
+ }
74
+
75
+ </style>
76
+
77
+ </head>
78
+
79
+
80
+
81
+ <body>
82
+
83
+ <h1>Blade/Index</h1>
84
+
85
+ <p>{{$msg}}</p>
86
+
87
+ <form method="POST" action="/hello">
88
+
89
+ {{ csrf_field() }}
90
+
91
+ <input type="text" name="msg">
92
+
93
+ <input type="submit">
94
+
95
+ </form>
96
+
97
+ </body>
98
+
99
+
100
+
101
+ </html>
102
+
103
+ ```
104
+
105
+ > web.php
106
+
107
+ ```web.php
108
+
109
+ <?php
110
+
111
+
112
+
113
+ /*
114
+
115
+ |--------------------------------------------------------------------------
116
+
117
+ | Web Routes
118
+
119
+ |--------------------------------------------------------------------------
120
+
121
+ |
122
+
123
+ | Here is where you can register web routes for your application. These
124
+
125
+ | routes are loaded by the RouteServiceProvider within a group which
126
+
127
+ | contains the "web" middleware group. Now create something great!
128
+
129
+ |
130
+
131
+ */
132
+
133
+
134
+
39
- ![ソースコード1](6ce8eecd9becbfe847c9912810c4657c.png)
135
+ Route::get('/', function () {
136
+
40
-
137
+ return view('welcome');
138
+
139
+ });
140
+
141
+
142
+
143
+ Route::get('hello', 'HelloController@index');
144
+
145
+
146
+
147
+ ```
148
+
149
+ > HelloController.php
150
+
151
+ ```HelloController.php
152
+
153
+ <?php
154
+
155
+
156
+
157
+ namespace App\Http\Controllers;
158
+
159
+
160
+
161
+ use Illuminate\Http\Request;
162
+
163
+ use Illuminate\Http\Response;
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+ class HelloController extends Controller
172
+
173
+ {
174
+
175
+ public function index()
176
+
177
+ {
178
+
179
+ $data = [
180
+
41
- ![ソースコード2](a2ab9c2c5d8abea582f32544d1754f1f.png)
181
+ 'msg' => '名前を入力してください。',
182
+
183
+ ];
184
+
185
+ return view('hello.index', $data);
186
+
187
+ }
188
+
189
+
190
+
191
+ public function post(Request $request)
192
+
193
+ {
194
+
195
+ $msg = $request->msg;
196
+
197
+ $data = [
198
+
199
+ 'msg' => 'こんちは、' . $msg . 'さん!',
200
+
201
+ ];
202
+
203
+ return view('hello.index', $data);
204
+
205
+ }
206
+
207
+ }
208
+
209
+
210
+
211
+ ```