어떻게 헤더 출력 오류가 발생하지 않고 아래의 설정으로 PHP에서 리디렉션 할 수 있습니까? 헤더가 설정되기 전에 브라우저에 아무 것도 인쇄 할 수 없다는 것을 알고 해결책을 찾고 있습니다. 이유에 대한 설명이 아닙니다.헤더 오류없이 PHP에서 리디렉션 할 수 있습니까?
<?PHP
// include header
include ('header.inc.php');
// In my body section file if this is a page that requires a user be logged in then
// I run a function validlogin($url-of-page-we-are-on); inside of that file
//the function is below, it outputs a redirect to login page if not logged in
// include body of page we want
include ('SOME-FILE-HERE.php');
// include footer
include ('footer.inc.php');
// here is the function that is in the body pages, it is only called on a page that we require a logged in user so there are hundreds of pages that do have this and a bunch that don't, it's on a page to page basis
function validlogin($url) {
if ($_SESSION['auto_id'] == '') {
$msg = 'Please login';
$_SESSION['sess_login_msg'] = $msg;
$_SESSION['backurl'] = $url;
$temp = '';
header("Location: /");
exit();
}
}
?>
나는 사용자 PHP의 헤더 기능 싶습니다 아닌 메타, 자바 스크립트 리디렉션
그게 내가 한 짓을 내 질문의 업데이트 섹션을 읽으십시오 – JasonDavis
미안 해요 같은 문제에 관한 또 다른 질문이 있었는데, 난 이걸 알고 있었어 어쨌든 그것은 내가 일찍 끝내고 결국 잘 했어. – JasonDavis