PHP Laravel – 여러개의 파일 만들기

 \app\Http\Controllers\PagesController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class PagesController extends Controller
{
public function index()
{
return view('pages.index');
}

public function about()
{
return view('pages.about');
}

public function services()
{
return view('pages.services');
}

}

\resources\views\pages\index.blade.php

<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{config('app.name','LSAPP')}}</title>
</head>
<body>
<h1>INDEX PAGE</h1>
<p>The index page</p>
</body>
</html>

\resources\views\pages\about.blade.php

<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{config('app.name','LSAPP')}}</title>
</head>
<body>
<h1>About PAGE</h1>
<p>The About page</p>
</body>
</html>

\resources\views\pages\services.blade.php

<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{config('app.name','LSAPP')}}</title>
</head>
<body>
<h1>Services PAGE</h1>
<p>The Services page</p>
</body>
</html>

\routes\web.php

<?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('/','PagesController@index');
Route::get('/about','PagesController@about');
Route::get('/services','PagesController@services');

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다