秀和システム出版の「Laravel入門 第2版(Lavel6)」を使って勉強中です
Lavavelをcomposerでインストールしたところ 8.83.9 になりました
Viewのところでコードを書いたのですがエラーが発生してしまいます
書籍に従い、次のようにコードを書いています
Laverl7,8でRoute,View の書き方が変わったのかと思いましたが、それらの情報は見つけられませんでした
どこに問題が有るのか分かりますでしょうか?
よろしくお願いします
php
1/* 2 * laravelapp/routes/web.php 3 */ 4use App\Http\Controllers\HelloController; 5use Illuminate\Support\Facades\Route; 6 7/* 8|-------------------------------------------------------------------------- 9| Web Routes 10|-------------------------------------------------------------------------- 11| 12| Here is where you can register web routes for your application. These 13| routes are loaded by the RouteServiceProvider within a group which 14| contains the "web" middleware group. Now create something great! 15| 16*/ 17 18Route::get('/', function () { 19 return view('welcome'); 20}); 21// ↓これが問題発生 22Route::get('hello', function() { 23 return view('hello.index'); 24}); 25/* ↓この2つはOKだった 26Route::get('hello', function() { 27 return "sample text"; 28}); 29Route::get('hello', function () { 30 return view('welcome'); 31}); 32*/ 33//Route::get('index/{id?}/{pass?}',[HelloController::class, 'index']);
php
1/* 2 * laravelapp/resources/views/hello/index.php 3 */ 4<html> 5<head> 6 <title>Hello</title> 7 <style> 8 body { font-size: 16px; color: #999 } 9 h1 { font-size: 100px; text-align: right; color: #eee; margin: -40px 0 -50px 0; } 10 </style> 11</head> 12<body> 13<h1>Index</h1> 14<p>This is a sample page with php-template.</p> 15</body> 16</html>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。