laravelを学習していたのですが、お聞きしたい部分があった為、ご質問させて頂きました。
<?php /* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | contains the "web" middleware group. Now create something great! | */ // Route::get('hello','HelloController@index'); // Route::post('hello','HelloContoroller@post'); $html = <<<EOF <html> <head> <title>Hello</title> <style> body {font-size:16pt;color:#999;} h1 {font-size:100pt;text-align:right; color:#eee; margin:-40px 0px -50px 0px; } </style> </head> <body> <h1>Hello</h1> <p>This is sample page</p> <p>これは、サンプルで作ったページです。</p> </body> </html> EOF; Route::get('hello',function() use ($html){ return $html; });
上記コードは、ルート情報を管理する、「routes」フォルダ内の「web.php」です
お聞きしたい部分は、「Route::get('hello',function() use ($html){return $html;});」こちらのuse 以降の記載についてです。
useを調べましたら、クラスを宣言する際に使用されるとの情報がありましたが、クラスなどは作っていないため、クラスとは無関係に思えます。
どなたか、情報をお持ちでしたらご助言頂けましたら幸いです。
よろしくお願いします
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/05/11 03:33
2019/05/11 03:34
退会済みユーザー
2019/05/11 03:35
退会済みユーザー
2019/05/11 03:37
退会済みユーザー
2019/05/11 03:38
退会済みユーザー
2019/05/11 03:41 編集
2019/05/11 03:43
退会済みユーザー
2019/05/11 03:47
2019/05/11 03:58