웹개발/PHP

[PHP] 함수, form, GET/POST, 글 생성/수정/삭제 by.생활코딩

ruming 2021. 1. 25. 07:15

이번 시간에는 함수 만드는 것부터 강의 끝까지 포스팅 할 예정이다.

 

이번 포스팅에 사용한 함수

#file_put_contents

#rename

#unlink

 

함수의 형식 1~3

 

#USER-DEFINED FUNTIONS

 

사용자 정의 함수

 

긴 코드는 이해하는 것이 복잡할 수 있다.

그리고 같은 기능을 반복할 때, 코드를 복붙하면 코드가 길어진다.

우리가 반복되는 기능을 함수로 만들면 이런 불편함을 간소화할 수 있다. 그리고 코드를 간결화할 수 있다.

 

간단한 함수를 만들어보자.

<!DOCTYPE html>
<html>
  <body>
    <?php
      function basic(){
        print("hello world.<br>");
        print("hi human.<br>");
      }
      basic();
    ?>
  </body>
</html>

함수를 만드는 방식은 이렇다.

function 함수이름(){ 실행문 }

사용방법은 간단하다.

basic();

 

위의 함수는 문자열을 출력하는 함수이다. 결과를 보자.

 

함수를 만드는 것은 코드의 재사용, 이름 부여, 수정의 간편함 등의 측면이 있다.

 

간단하게 덧셈을 하는 함수를 하나 더 만들어보자.

<!DOCTYPE html>
<html>
  <body>
    <?php
      function basic(){
        print("hello world.<br>");
        print("hi human.<br>");
      }
      basic();
      function sum($left, $right){
        print($left+$right);
      }
      sum(3,8);
    ?>
  </body>
</html>

sum이라는 이름의 함수는 좌항과 우항을 더한 값을 출력하는 함수다.

이 함수는 입력값에 따라 결과가 다르게 나오는 함수다.

여기서 $left, $right를 매개변수(parameter)라고 하고

그 입력값을 argument라고 한다.

 

 

하나의 함수는 하나의 기능만을 갖는다.

 

 sum 함수를 이용해 계산한 출력값을 어딘가에 저장하거나 전송하려면 무언가가 더 필요하다.

이번에는 sum2함수를 만들어, 결과를 출력하고 파일에 저장해 볼 것이다.

 

#file_put_contents

이 함수는 파일에 데이터를 쓰는 함수다.

<!DOCTYPE html>
<html>
  <body>
    <?php
      function basic(){
        print("hello world.<br>");
        print("hi human.<br>");
      }
      basic();
      function sum($left, $right){
        print($left+$right);
        print("<br>");
      }
      sum(3,8);
      function sum2($left, $right){
        return $left+$right;
      }
      print(sum2(2,4));
      file_put_contents('result.txt', sum2(11, 5));
    ?>
  </body>
</html>

return문은 값을 반환한다.

그리고 return을 만나면 함수는 종료되기 때문에 뒤에 코드가 있어도 무시된다.

 

이제 print를 이용해 반환한 값을 출력하고,

file_put_contents함수를 이용해 result.txt라는 파일이 만들어지고 거기에 11+5의 값이 저장될 것이다.

 

페이지를 로드하자 result.txt 파일이 만들어지고 16이 저장되었다.

 

웹페이지에는 2+4의 값인 6이 출력되었다.

 

표현식[expresstion]이라는 것은 최종적으로 값이 있어야 하기 때문에, 함수 자체는 statement다.

리턴값이 있다면 그것은 값이 있기 때문에 표현식이다.

 


함수의 활용

 

index.php에서 함수를 만들어보자.

<?php
  function print_title(){
    if(isset($_GET['id'])){
      echo $_GET['id'];
    }else{
      echo "Welcome";
    }
  }
  function print_description(){
    if(isset($_GET['id'])){
      echo file_get_contents("data/".$_GET['id']);
    }else{
      echo "Hello, PHP";
    }
  }
  function print_list(){
    $list = scandir('./data');
    $i = 0;
    while($i < count($list)){
      if($list[$i]!='.'&&$list[$i]!='..'){
        echo "<li><a href=\"index.php?id=$list[$i]\">$list[$i]</li>";
      }
      $i = $i + 1;
    }
  }
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>
      <?php
        print_title();
      ?>
    </title>
  </head>
  <body>
    <h1><a href="index.php">WEB</h1>
    <ol>
      <?php
        print_list();
      ?>
    </ol>
    <h2>
      <?php
        print_title();
      ?>
    </h2>
    <?php
      print_description();
    ?>
  </body>
</html>

 

원래 기능이 있던 여러 코드를 이름을 붙여 함수로 만들었다. 

이제 같은 기능을 하는 코드는 함수를 사용하기만 하면 된다.

 


정보시스템에서 가장 중요한 것을 C R U D로 부른다.

Create, Read, Update, Delete 이 네가지를 항상 제일 먼저 만들어야 한다.

 

form과 POST

 

#POST

#GET

 

잠시 html로 돌아가서, form에 대해 복습해보자.

▽form.html

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <form action="form.php">
      <input type="text" name="title" placeholder="Title">
      <input type="submit">
    </form>
  </body>
</html>

form 태그는 입력값을 다른 서버로 전송해주는 태그인데,

action 속성이 전송되는 서버이다. 전송되는 서버의 주소를 적는 곳이고, 

placeholder는 무엇을 적을지 알려주는 안내이다.

 

빈칸에 제목을 입력하고 제출을 누르면

 

아직 form.php가 없기 때문에 이렇게 뜬다.

 

그럼 이제 form.php 파일을 만들어보자.

▽form.php

<?php
  echo $_GET['title'];
?>

문자로 index를 주는 배열을 연관배열이라고 한다.

 

이제 실행하면 form.php로 넘어가서 입력값을 출력해 줄 것이다. 

제출 클릭

hello가 나온다.

 

 

textarea 태그를 이용해 내용을 더 작성해보자.

▽form.html

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <form action="form.php">
      <p><input type="text" name="title" placeholder="Title"></p>
      <p><textarea name="description"></textarea></p>
      <p><input type="submit"></p>
    </form>
  </body>
</html>

textarea의 name은 description으로 주고

▽form.php

<?php
  echo "<p>title : ".$_GET['title']."</p>";
  echo "<p>description : ".$_GET['description']."</p>";
?>

description을 받아 출력한다.

 

 

이런식으로 입력하고 제출하면

 

이렇게 출력이 된다.

 

주소를 보면

http://127.0.0.1/form.php?title=hello&description=hello+is+...

이렇게 되어 있는데

form태그로 입력한 값이 url 파라미터로 넘어간다.

form의 기본값은 get방식이기 때문에 주소창에 파라미터가 포함된다.

이 방식은 데이터가 추가될 수 있고 보안에도 문제가 있기 때문에 보통 post방식을 사용한다.

 

그러면 어떤 경우에 get방식을 사용하는가?

우리가 만든 index.php 파일과 같이 어떤 리스트를 누르고 그 페이지로 오게하고 싶다면,

파라미터를 포함한 url을 보내서 그 특정 페이지로 오게 하는 것이다.

 

즉, url 파라미터를 통해 서버에 데이터를 전송하는 것은 북마크에서 사용하기 적합하다. 

어떤 컨텐츠를 다른 사람에게 공유할 때 적합한 방식이다.

 

post방식을 설정하려면 method 속성을 이용하면 된다.

▽form.html

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <form action="form.php" method="post">
      <p><input type="text" name="title" placeholder="Title"></p>
      <p><textarea name="description"></textarea></p>
      <p><input type="submit"></p>
    </form>
  </body>
</html>

▽form.php

<?php
  file_put_contents('data/'.$_GET['title'], $_GET['description']);
?>

php파일을 수정했다.

 

이런 식으로 입력하고 제출을 누르면

먼저 주소창에 파라미터가 없어졌다. 

 

그리고 우클릭 - 검사 - 네트워크에서 

ctrl+r을 누르고 header에서 맨 밑에 있는 form data를 보면

이렇게 은밀히 데이터가 전송된 것을 알 수 있다.

 

오류가 나는 이유는 php에서 GET방식으로 데이터를 받았기 때문이다.

POST로 변경하면 오류는 뜨지 않는다.

<?php
  file_put_contents('data/'.$_POST['title'], $_POST['description']);
?>

 

POST와 GET에 대한 자세한 설명

 


글생성

이번에는 아까 사용한 form을 이용해 글을 쓰는 페이지를 만들 것이다.

 

먼저 index.php에 create라는 링크를 만든다. 이 링크를 누르면 글을 생성할 수 있다.

▽index.php

<?php
  function print_title(){
    if(isset($_GET['id'])){
      echo $_GET['id'];
    }else{
      echo "Welcome";
    }
  }
  function print_description(){
    if(isset($_GET['id'])){
      echo file_get_contents("data/".$_GET['id']);
    }else{
      echo "Hello, PHP";
    }
  }
  function print_list(){
    $list = scandir('./data');
    $i = 0;
    while($i < count($list)){
      if($list[$i]!='.'&&$list[$i]!='..'){
        echo "<li><a href=\"index.php?id=$list[$i]\">$list[$i]</li>";
      }
      $i = $i + 1;
    }
  }
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>
      <?php
        print_title();
      ?>
    </title>
  </head>
  <body>
    <h1><a href="index.php">WEB</h1>
    <ol>
      <?php
        print_list();
      ?>
    </ol>
    <a href="create.php">create</a>	//추가된 부분
    <h2>
      <?php
        print_title();
      ?>
    </h2>
    <?php
      print_description();
    ?>
  </body>
</html>

 

그리고 create.php라는 파일을 만들어 index.php를 붙여넣기하고 필요없는 함수를 삭제해준다.

▽create.php

<?php
  function print_title(){
    if(isset($_GET['id'])){
      echo $_GET['id'];
    }else{
      echo "Welcome";
    }
  }
  function print_description(){
    if(isset($_GET['id'])){
      echo file_get_contents("data/".$_GET['id']);
    }else{
      echo "Hello, PHP";
    }
  }
  function print_list(){
    $list = scandir('./data');
    $i = 0;
    while($i < count($list)){
      if($list[$i]!='.'&&$list[$i]!='..'){
        echo "<li><a href=\"index.php?id=$list[$i]\">$list[$i]</li>";
      }
      $i = $i + 1;
    }
  }
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>
      <?php
        print_title();
      ?>
    </title>
  </head>
  <body>
    <h1><a href="index.php">WEB</h1>
    <ol>
      <?php
        print_list();
      ?>
    </ol>
    <a href="create.php">create</a>
    <form action="create_process.php" method="post">	//form 추가
      <p>
        <input type="text" name="title" placeholder="Title">
      </p>
      <p>
        <textarea name="description" placeholder="Description"></textarea>
      </p>
      <p>
        <input type="submit">
      </p>
    </form>		//필요 없는 함수 두 개 제거
  </body>	
</html>

해당 링크 아래에 form을 추가했다. post 방식이고 제목과 내용을 입력할 수 있다.

제출하면 create_process.php로 넘어가므로 그 파일도 만들도록 하자.

▽create_process.php

<?php
  file_put_contents('data/'.$_POST['title'], $_POST['description']);
?>

create_process.php 파일이다.

아까와 같이 post 방식으로 내용을 넘겨주었다.

 

아래 사진은 create 링크를 눌러 create.php로 넘어간 상태이다.

 

다음과 같은 문장을 작성하고

제출을 누르면 

아무것도 없는 create_process.php로 넘어가고 

 

다시 뒤로 가서 페이지를 새로고침하면

php3이 추가된 것이 보인다.

 

내용도 잘 저장이 되었다.

 

아까 create_process.php의 화면에 아무것도 나오지 않았기 때문에,

제출하고 바로 생성된 페이지로 이동하도록 해보자.

 

웹의 기능에는 redirection이라는 기능이 있다.

이 기능을 이용하면 제출한 후 바로 원하는 페이지로 이동시킬 수가 있다.

▽create_process.php

<?php
  file_put_contents('data/'.$_POST['title'], $_POST['description']);
  header('Location: /index.php?id='.$_POST['title']);	//redirection
?>

 

form에 내용을 입력하고 제출을 누르면

생성된 파일로 바로 이동한다.

 


글수정

 

create와 read를 마쳤으니 update의 차례다.

▽index.php

<?php
  function print_title(){
    if(isset($_GET['id'])){
      echo $_GET['id'];
    }else{
      echo "Welcome";
    }
  }
  function print_description(){
    if(isset($_GET['id'])){
      echo file_get_contents("data/".$_GET['id']);
    }else{
      echo "Hello, PHP";
    }
  }
  function print_list(){
    $list = scandir('./data');
    $i = 0;
    while($i < count($list)){
      if($list[$i]!='.'&&$list[$i]!='..'){
        echo "<li><a href=\"index.php?id=$list[$i]\">$list[$i]</li>";
      }
      $i = $i + 1;
    }
  }
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>
      <?php
        print_title();
      ?>
    </title>
  </head>
  <body>
    <h1><a href="index.php">WEB</h1>
    <ol>
      <?php
        print_list();
      ?>
    </ol>
    <a href="create.php">create</a>
    <?php if(isset($_GET['id'])) { ?>	//추가
      <a href="update.php">update</a>	//추가
    <?php } ?>				//추가
    <h2>
      <?php
        print_title();
      ?>
    </h2>
    <?php
      print_description();
    ?>
  </body>
</html>

위는 index.php를 id가 있을 때만 upload가 생기도록 수정한 코드이다.

중간에 왜 php 를 끊어서 두 번 사용하는건지 잘 이해가 안 갔었는데, 그냥 php 코드가 아니어서 끊었던 것 같다.

php 코드 하나에 echo로 출력시키니까 오류가 나지 않았다.

<?php if(isset($_GET['id'])) {
      echo "<a href=\"update.php\">update</a>";
    } ?>

아직 php와 html에서 헷갈리는 게 있는 것 같다.

 

update는 수정사항이 뭔지 알아야 하기 때문에 id값을 물고 들어가야 한다.

▽index.php

<?php
  function print_title(){
    if(isset($_GET['id'])){
      echo $_GET['id'];
    }else{
      echo "Welcome";
    }
  }
  function print_description(){
    if(isset($_GET['id'])){
      echo file_get_contents("data/".$_GET['id']);
    }else{
      echo "Hello, PHP";
    }
  }
  function print_list(){
    $list = scandir('./data');
    $i = 0;
    while($i < count($list)){
      if($list[$i]!='.'&&$list[$i]!='..'){
        echo "<li><a href=\"index.php?id=$list[$i]\">$list[$i]</li>";
      }
      $i = $i + 1;
    }
  }
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>
      <?php
        print_title();
      ?>
    </title>
  </head>
  <body>
    <h1><a href="index.php">WEB</h1>
    <ol>
      <?php
        print_list();
      ?>
    </ol>
    <a href="create.php">create</a>
    <?php if(isset($_GET['id'])) { ?>
      <a href="update.php?id=<?php echo $_GET['id']; ?>">update</a>	//수정
    <?php } ?>
    <h2>
      <?php
        print_title();
      ?>
    </h2>
    <?php
      print_description();
    ?>
  </body>
</html>

저기서 php echo 부분을 줄일 수가 잇다.

<?= $_GET['id'] ?>

 

이제 update 파일을 추가하자.

수정을 하려면 빈칸이 아니라 원래 내용이 들어 있어야 한다. 

value 속성을 이용해 그것을 할 수 있다.

▽update.php

<?php
  function print_title(){
    if(isset($_GET['id'])){
      echo $_GET['id'];
    }else{
      echo "Welcome";
    }
  }
  function print_description(){
    if(isset($_GET['id'])){
      echo file_get_contents("data/".$_GET['id']);
    }else{
      echo "Hello, PHP";
    }
  }
  function print_list(){
    $list = scandir('./data');
    $i = 0;
    while($i < count($list)){
      if($list[$i]!='.'&&$list[$i]!='..'){
        echo "<li><a href=\"index.php?id=$list[$i]\">$list[$i]</li>";
      }
      $i = $i + 1;
    }
  }
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>
      <?php
        print_title();
      ?>
    </title>
  </head>
  <body>
    <h1><a href="index.php">WEB</h1>
    <ol>
      <?php
        print_list();
      ?>
    </ol>
    <a href="create.php">create</a>
    <?php if(isset($_GET['id'])) { ?>
      <a href="update.php?id=<?= $_GET['id'] ?>">update</a>
    <?php } ?>
    <h2>
      <?php
        print_title();
      ?>
    </h2>
    <?php
      print_description();
    ?>

    <form action="create_process.php" method="post">
      <p>
        <input type="text" name="title" placeholder="Title" value="<?php print_title(); ?>">	//수정
      </p>
      <p>
        <textarea name="description" placeholder="Description"><?php print_description(); ?></textarea>	//수정
      </p>
      <p>
        <input type="submit">
      </p>
    </form>
  </body>
</html>

title은 value 속성으로 원래 내용을 넣고 textarea는 이어서 내용을 넣는다.

 

php2를 클릭하고 update를 누르면 이렇게 된다.

 

자 그럼 이제 내용을 수정했을 때, data 파일의 제목과 내용을 어떻게 바꿀 수 있는가?

 

검색어

php file name change

 

#rename

파일의 이름을 바꿀 수 있는 함수다.

rename(oldname, newname)

글에서 수정을 했으면 그것은 newname이다. 그래서 두번째 인자로 들어와야 하는데, 

title이 두번째 인자로 들어가면 첫번째 인자에는 어떻게 써야 할까?

이 문제를 해결하기 위해 update.php 파일로 돌아왔다.

▽update.php

<?php
  function print_title(){
    if(isset($_GET['id'])){
      echo $_GET['id'];
    }else{
      echo "Welcome";
    }
  }
  function print_description(){
    if(isset($_GET['id'])){
      echo file_get_contents("data/".$_GET['id']);
    }else{
      echo "Hello, PHP";
    }
  }
  function print_list(){
    $list = scandir('./data');
    $i = 0;
    while($i < count($list)){
      if($list[$i]!='.'&&$list[$i]!='..'){
        echo "<li><a href=\"index.php?id=$list[$i]\">$list[$i]</li>";
      }
      $i = $i + 1;
    }
  }
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>
      <?php
        print_title();
      ?>
    </title>
  </head>
  <body>
    <h1><a href="index.php">WEB</h1>
    <ol>
      <?php
        print_list();
      ?>
    </ol>
    <a href="create.php">create</a>
    <?php if(isset($_GET['id'])) { ?>
      <a href="update.php?id=<?= $_GET['id'] ?>">update</a>
    <form action="update_process.php" method="post">
      <input type="hidden" name="old_title" value="<?=$_GET['id]?>">	//추가
      <p>
        <input type="text" name="title" placeholder="Title" value="<?php print_title(); ?>">
      </p>
      <p>
        <textarea name="description" placeholder="Description"><?php print_description(); ?></textarea>
      </p>
      <p>
        <input type="submit">
      </p>
    </form>
  </body>
</html>

이전파일명에 대한 정보를 따로 서버에 넘겨주면 된다.

눈에 보이지 않는 hidden속성을 사용해 old_title을 만들어 준다.

 

<?php
  rename('data/'.$_POST['old_title'], 'data/'.$_POST['title']);
  file_put_contents('data/'.$_POST['title'], $_POST['description']);
  header('Location: /index.php?id='.$_POST['title']);
?>

아까와 같이 file_put_contents를 사용해 수정된 내용을 넣어주면 기존 파일이 바뀔 것이다.

그리고 file_put_contents에서 description은 내용을 덮어쓰기 때문에 따로 변경할 필요가 없다.

 

php2를 php5로 수정하고 제출을 누르면

 

php5로 변경되었다. 리스트에도 php2가 사라지고 php5가 생겼다.

 

data 폴더에도 마찬가지로 php2가 사라지고 php5가 생성되었다.

 


글삭제

마지막으로 delete를 알아보자.

 

delete는 update와 다르게 form이 필요 없기 때문에

링크를 바로 delete_process.php로 넘길 것이다.

▽index.php▽

<?php
  function print_title(){
    if(isset($_GET['id'])){
      echo $_GET['id'];
    }else{
      echo "Welcome";
    }
  }
  function print_description(){
    if(isset($_GET['id'])){
      echo file_get_contents("data/".$_GET['id']);
    }else{
      echo "Hello, PHP";
    }
  }
  function print_list(){
    $list = scandir('./data');
    $i = 0;
    while($i < count($list)){
      if($list[$i]!='.'&&$list[$i]!='..'){
        echo "<li><a href=\"index.php?id=$list[$i]\">$list[$i]</li>";
      }
      $i = $i + 1;
    }
  }
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>
      <?php
        print_title();
      ?>
    </title>
  </head>
  <body>
    <h1><a href="index.php">WEB</h1>
    <ol>
      <?php
        print_list();
      ?>
    </ol>
    <a href="create.php">create</a>
    <?php if(isset($_GET['id'])) { ?>
      <a href="update.php?id=<?= $_GET['id'] ?>">update</a>
      <a href="delete_process.php?id=<?= $_GET['id'] ?>">delete</a>	//추가
    <?php } ?>
    <h2>
      <?php
        print_title();
      ?>
    </h2>
    <?php
      print_description();
    ?>
  </body>
</html>

 

delete 방법을 검색해보자.

검색어

php file delete

 

#unlink

파일을 삭제하는 함수이다.

 

▽delete_process.php▽

<?php
  unlink('data/'.$_GET['id']);
  header('Location: /index.php');
?>

 

이제 삭제하고 싶은 파일을 클릭해 delete 버튼을 클릭만 하면 바로 삭제된다.

title2를 삭제해보겠다.

 

파일이 삭제되고 홈으로 이동했다.

 

그렇지만 이 방식은 누르기만 하면 바로 삭제되기 때문에 좋은 방법은 아니다.

링크가 아닌 다른 방식으로 삭제를 구현해보자.

▽index.php

<?php
  function print_title(){
    if(isset($_GET['id'])){
      echo $_GET['id'];
    }else{
      echo "Welcome";
    }
  }
  function print_description(){
    if(isset($_GET['id'])){
      echo file_get_contents("data/".$_GET['id']);
    }else{
      echo "Hello, PHP";
    }
  }
  function print_list(){
    $list = scandir('./data');
    $i = 0;
    while($i < count($list)){
      if($list[$i]!='.'&&$list[$i]!='..'){
        echo "<li><a href=\"index.php?id=$list[$i]\">$list[$i]</li>";
      }
      $i = $i + 1;
    }
  }
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>
      <?php
        print_title();
      ?>
    </title>
  </head>
  <body>
    <h1><a href="index.php">WEB</h1>
    <ol>
      <?php
        print_list();
      ?>
    </ol>
    <a href="create.php">create</a>
    <?php if(isset($_GET['id'])) { ?>
      <a href="update.php?id=<?= $_GET['id'] ?>">update</a>
      <form action="delete_process.php" method="post">			//추가
        <input type="hidden" name="id" value="<?=$_GET['id']?>">	//추가
        <input type="submit" value="delete">				//추가
      </form>
    <?php } ?>
    <h2>
      <?php
        print_title();
      ?>
    </h2>
    <?php
      print_description();
    ?>
  </body>
</html>

이렇게 하면 delete버튼이 생긴다. post방식으로 구현했기 때문에 링크로 삭제되지 않는다.

submit에서 value는 레이블이다.

 

post방식이기 때문에 delete_process.php 파일도 post로 바꾼다.

<?php
  unlink('data/'.$_POST['id']);
  header('Location: /index.php');
?>

 

php3에서 삭제 버튼을 누르면 파일이 삭제되고 홈으로 이동할 것이다.

 

성공!

 

php3 파일도 없어졌다.

 

여기까지 C, R, U, D의 과정을 모두 끝냈다! 

포스팅이 길어져서 이번엔 여기서 끝내도록 하겠다.