1.
header("Location: http://example.com");
echo "이 메시지는 사용자에게 보이지 않습니다.";
2.
header("Location: http://example.com");
exit(); // 이 코드로 인해 이후의 PHP 코드는 실행되지 않습니다.
echo "이 메시지는 사용자에게 보이지 않습니다.";
3.
$db->close();
header("Location: http://example.com?error=알 수 없는 오류가 발생했습니다.");
exit();
header("Location: http://example.com"); 실행 이후에 echo "이 메시지는 사용자에게 보이지 않습니다."; 도 실행
header("Location: http://example.com"); 실행 이후에 스크립트 종료 =>
echo "이 메시지는 사용자에게 보이지 않습니다.";는 처리되지 않음.
3.$db->close();가 exit(); 이후에 실행되지 않기 때문에 header()랑 같이 사용할때는 위치는 항상 header() 앞에 위치해야된다.