Development requires contact with PHP, and I feel that I can get started quickly. I always make errors when debugging SESSION in PHP,
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at XXX:2) in .php on line 3
Similar to the error, I looked at the source code and it seems that I didn’t make any mistakes.
php start symbol
The session cannot output any characters before starting,
header() is the same
Add the code in advance and remove the spaces in front of it, and that’s it.
------------------Correct
session_start();
$username;
$username = "test";
session_register("username");
echo $_SESSION[username];
?>
------------------Error
session_start();
$username;
$username = "test";
session_register("username");
echo $_SESSION[ username];
?>