1. Configure php.ini and modify session.save_path
such as: session.save_path = d:/developer/php/temp or /tmp
2. Program
1.php
session_start();
$var1 = "test";
session_register("var1");
?>
2.php
session_start() ;
echo $var1;
?>
First run 1.php, then run 2.php, the page should have test
session "headers already sent" error
Error prompt: Cannot send session cookie - headers already sent by ...
This error occurs because there is an output statement before the session_start(); statement in the page
as follows:
session_start();
$var1 = "test";
session_register("var1");
?>