Hello, everyone, I have come again. My page is written as follows: session_start (); if ($ _ SESSION [Admin] | $ _ SESSION [ID]) {echo & lt; script & gt ;; echoparent. location. href & quot; Login. php & quot; logon page Session
Hello everyone, I'm coming again.
My page is written as follows:
Session_start ();
If ($ _ SESSION ['admin'] = ''| $ _ SESSION ['id'] = ''){
Echo 'script ';
Echo 'parent. location. href = "Login. php ";';
Echo 'script ';
}
------------------------------------------------------
The problem is that when the page is opened, it always prompts an error, and there is no Session ['admin'] variable.
Although the page will continue to be executed, it is always bad to make a mistake.
Do you have any good methods except @ to suppress errors.
------ Solution --------------------
If (isset ($ _ SESSION ['admin']) & isset ($ _ SESSION ['id']) {
Code .....
} Else {
Echo 'script ';
Echo 'parent. location. href = "Login. php ";';
Echo 'script ';
Exit;
}
------ Solution --------------------
Isset determines whether a value has been assigned. this is the same as undefined in js.