세션 변수를 사용할 수 있습니까? 그 후에 바로 설정 해제 하시겠습니까?사용 후 세션 변수 지우기
예 :
양식을 제출//====
//Process Form
if ($_POST['Submit']) {
$update = $userSettings->update($_POST);
//If there are form errors
if (!$update) {
//Load the errors into an array
$errors = $update[1];
} else {
//Set the session
$_SESSION['showUpdated'] = true;
//Redirect to this page
header("Location: http://www.mysite.com/settings");
}
}
//==================
if ($_SESSION['showUpdated']) {
echo "Settings Updated";
unset($_SESSION['showUpdated'];
}
그래서 후, 오류가없는 경우 :
- 가 (양식 제출
- 페이지를 새로 고침 괜찮다고 말할 세션을 설정은
- 'showUpdated'세션 변수가 설정된 경우 "업데이트 됨"메시지 표시
- 세션 변수 설정 해제 (다음 재로드시 메시지가 표시되지 않도록)
현재 세션 변수를 직접 설정 해제하면 문제가 발생합니다. 마치 "존재하는"부분 앞에 설정을 해제 한 것과 같습니다.
모든 솔루션? 이것이 최선의 방법일까요?
감사합니다.
exit() 또는 die()가 내가 놓친 부분이었습니다. 감사합니다! – steveneaston