여러분의 후원은 큰 힘이 됩니다. 기업은행 35611080101018
반응형
Client -> FTController -> Controller
web : 주로 일반 페이지만 불러오는 곳
Route : 페이지 이동 및 Controller 연결
Controller : 페이지 이동 및 복잡한 데이터처리.
get 방식
1. Route::get('path', [ controller name::class,'function name']);
Route::get('get', [Amain::class, 'index']);
ex )
/routes/web.php
use App\Http\Controllers\standard\main as Amain;
Route::get('path', [ controller name::class,'function name']);
Route::get('get', [Amain::class, 'index']);
App/Http/Controllers/standard/main.php
public function index(){
// /resources/views/welcome.blade.php 을 가르킨다.
return view("welcome");
}
2. Route::get('path', function(){ });
Route::get('get/{id}', function ($id) {
// return view('standard.header').view('welcome').view('standard.footer');
// /resources/views/welcome.blade.php를 가르킨다.
return view('welcome',['id' => $id]);
});
ex )
routes/web.php
Route::get('get/{id}', function ($id) {
// return view('standard.header').view('welcome').view('standard.footer');
// /resources/views/welcome.blade.php를 가르킨다.
return view('welcome',['id' => $id]);
});
/resources/views/welcome.blade.php
<div class="">
{{ $id }}
</div>
반응형
'PHP > Larabel' 카테고리의 다른 글
서비스 컨테이너, 서비스 프로바이더. (0) | 2023.07.21 |
---|---|
Route Post (0) | 2023.07.17 |
Sail artisan 명령어 (0) | 2023.07.17 |
laravel 페이지 불러오기 전까지 거치는 과정 (0) | 2023.07.15 |
windows10_ Composer을 이용하여 라라벨 설치하기 (0) | 2023.07.15 |