初学php:session

session_a.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>session</title>
<meta name="Generator" content="">
<meta name="Author" content="czh">
<meta name="Keywords" content="php date">
<meta name="Description" content="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?php 
session_start();
$_SESSION['title']='Session Example';
$_SESSION['chapter']='2';
$_SESSION['name']='session_b.php';
?>
<a href='./session_b.php'>Connect to the next file using a session instance</a>
</body>
</html>

session_b.php

<?php 
session_start();
echo '<br>title:'.$_SESSION['title'];
echo '<br>chapter:'.$_SESSION['chapter'];
echo '<br>name:'.$_SESSION['name'];
echo session_id();
?>

vinson
原文地址:https://www.cnblogs.com/vinsonLu/p/3043061.html