프로그래밍/Laravel5 14

Laravel - Ubuntu 라라벨 설치

#!/usr/bin/env bash # 패키지 목록 업데이트sudo apt-get update # 시스템 패키지 업데이트sudo apt-get -y upgrade ## PHP7 설치sudo apt-get install -y php7.0-cli php7.0-sqlite3 php7.0-curl php7.0-mcrypt php7.0-mysql php7.0-readline php7.0-mbstring php7.0-xml php7.0-zip php7.0-intl ## PHP7 fpm 설치sudo apt-get install php7.0-fpm ## MySQL 5.7 설치sudo apt-get install -y mysql-server-5.7 mysql-client-core-5.7 ## nginx, redissud..

Laravel - Layout상속

페이지 레이아웃을 정의하고 하위페이지느 이를 상속받아서 사용가능하다. resources/views/layouts/master.blade.php @yield('content') ※ 1. @yield는 자식 컨텐츠가 구현하도록 양보하는 구문 2. @yield('title','Default Title')로 미구현시 디폴트 값을 정할수 있다. routes/web.php Route::get('task/list3', function() { $tasks= [ ['name' => 'Response 클래스 분석', 'due_date' => '2015-06-01 11:22:33'], ['name' => '블레이드 예제 작성', 'due_date' => '2015-06-03 15:12:42'], ]; return view(..

Laravel - Blade Template (반복문)

routes/web.php Route::get('task/list2', function() { $tasks= [ ['name' => 'Response 클래스 분석', 'due_date' => '2015-06-01 11:22:33'], ['name' => '블레이드 예제 작성', 'due_date' => '2015-06-03 15:21:13'], ]; return view('task.list2')->with('tasks', $tasks); }); resouces/views/task/list2.blade.php ==foreach문== @foreach ($tasks as $task) 할 일: {{ $task['name'] }}, 기 한: {{ $task['due_date'] }} @endforeach ==fo..

Laravel - Blade Template

블레이드는 라라벨에 포함되어 있는 템플릿 엔진 문법을 간단히 할수있다. 블레이드와 기존 뷰를 구분하기 위해 블레이드 템플릿 파일은 파일명.blade.php 확장자를 붙인다. route/web.php Route::get('hello/html', function() { return view('hello.html'); }); == 블레이드 템플릿 == resources/views/task/view.blade.php 할일 정보 작 업: {{ $task['name'] }} 기 한: {{ $task['due_date'] }} -> {{ $변수 }} ※ blade템플릿은 사이트 간 스크립팅(CSS; Cross-Site Scripting) 같은 공격을 보호하는 보안의 측면에서 큰 장점도 있음 == CSS(XSS) 공격..

Laravel - HTTP Response 처리

HTTP Request (요청) 헤더 설명 참고사이트 : https://www.lesstif.com/pages/viewpage.action?pageId=26083967 HTTP Response (응답) 헤더 설명 참고 사이트 : https://www.lesstif.com/pages/viewpage.action?pageId=26083972 route/web.php use Illuminate\Http\Response; Route::get('hello/world/{name}',function(){ $response = new Response('Hello World ' . $name, 200); $response->header('Content-Type', 'text/plain'); return $response..