The example of this article for everyone to share the PHP session three ways to transfer, for your reference, the specific content as follows
Since learning to do the next note, to solve the data sharing, do not worry about, when you have to manually set up to open cookies!
(1) Pass session_id by Get way
<?php
$sid = "Test"; Sets the ID
session_id ($SID) for a session; The value of $sid as a session_id, easy to do test
session_start (); Open session
$_session[' user ' = "the way of delivery";
? >
<a href= "session_3.php?sid=<?php echo session_id ();?>" >test_1.php</a> //Will Session_ The value of the ID handles the modification of the
//php configuration file with Get arguments the effect of different configuration items
session.use_only_cookies = //Turn off this option, which is to allow the session to be generated automatically via get
<a href= "session_3.php? phpsessid=<?php echo session_id ()?> ">test_1.php</a>
//write, you can save yourself to get the value
through the $_get. Session.use_trans_sid = 1 //Turn this option on, will automatically use session_id
<a href= "session_2.php" >test_2.php</a> //No need to add any parameters to
==================================================
<a href= "SESSION_3.PHP<? php echo "?". Sid?> ">test_1.php</a> The setting of this is a bit forgotten anyway SID is a constant, contains the required content session information!
//session_3.php page
session_id ($_get[' Sid ')); Accept sesssion_id;
Session_Start ();
Var_dump ($_session); Print results look down
The result is as shown in figure:
(2) passed by hidden values in the form
The public part of the front is not changed
/is passed through the form form to pass
<form action= "" method= "post" >
name: <input type= "text" Name= "uname ">
<input type=" hidden "name=" Sid "Value=" <?php Echo session_id ();?> ">
<input type=" Submit "Value=" OK >
</form>
//session_4 page
$sid = $_post[' sid '];
session_id ($SID);
Session_Start ();
Var_dump ($_session); Print results Look, the results are the same can be achieved, no longer repeat the input result data
(3) The form of the document
The above is the entire content of this article, I hope to learn more about the way the PHP session is passed to help.