'PHP $_SESSION preventing or blocking website load
I have a simple page to check if the session are set or no
session_start();
if (!isset($_SESSION['id'])) {
$_SESSION['checkin'] = 'yes';
header("Location: https://blabla.php");
exit();
} else {
// do something here
}
<HTM>
web page
</HTML>
everytime i the session is not set, i would not load the page. i have try to delete the exit() funciton, page load correctly, but i cannot redirect it to the url
EDIT :
I am forget to write session_start(); here, but in my real code, they already inputed
Solution 1:[1]
It is likely that you have a non-header output before the header line.
Try adding an ob_start() after the session_start().
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | AndreC23 |
