PHP 리다이렉트 소개

header 함수를 사용하면 브라우저를 한 페이지에서 다른 페이지로 리다이렉트할 수 있습니다. 이를 위해 함수에 HTTP 헤더 Location을 전달해야 합니다:

index.php<?php
  header('Location: test.php');
?>

대상 페이지의 주소는 변수에 저장될 수도 있습니다:

index.php<?php
  $addr = 'test.php';
  header('Location: ' . $addr);
?>

문자열 연결 대신 변수 삽입을 사용할 수 있습니다:

index.php<?php
  $addr = 'test.php';
  header("Location: $addr");
?>
Задание 1

index.php 페이지에 접속할 때 page.php 페이지로 리다이렉트를 수행하세요.