session1.php
<?php session_start();?>
<html>
<?php
if(isset($_SESSION['hit']))
$_SESSION['hit']++;
else
$_SESSION['hit']=0;
?>
<head></head>
<body>
<?php
echo $_SESSION['hit'].'<br>';
//echo '<a href="session2.php">session2</a>';
echo '<META HTTP-EQUIV="refresh" content="0;URL=session2.php">'; //content="0; 只有一個”
?>
</body>
</html>
session2.php
<?php
session_start(); //記得本頁也得加session_start
echo $_SESSION['hit'];
?>
<?php session_start();?>
<html>
<?php
if(isset($_SESSION['hit']))
$_SESSION['hit']++;
else
$_SESSION['hit']=0;
?>
<head></head>
<body>
<?php
echo $_SESSION['hit'].'<br>';
//echo '<a href="session2.php">session2</a>';
echo '<META HTTP-EQUIV="refresh" content="0;URL=session2.php">'; //content="0; 只有一個”
?>
</body>
</html>
session2.php
<?php
session_start(); //記得本頁也得加session_start
echo $_SESSION['hit'];
?>
沒有留言:
張貼留言