之後就可以直接用
<?
session_start();
$_SESSION['go']="Hello!";
?>
來設定值
舉例來說
A.php的內容
<?
session_start();
$_SESSION['aa']="Hello!";
?>
<a href="B.php">B</a>
B.php的內容
<?
session_start();
echo $_SESSION['aa'];
?>
就會發現B.php會print出A.php的內容
這樣頁面間傳值相當好用喔!
關於SESSION還有很多用法
之後我再補充
感恩!
-----------------------
另外在使用SESSION時要注意在
session_start();
前不能有輸出文字
不然就不能成功,會報錯
這文字包含空白或亂碼
所以要注意伺服器與程式的編碼是不是不一樣
......Not really useful, I know all above by myself......
回覆刪除Maybe you can provide with better ways to illustrate the usage of SESSION, I will humbly receive them
回覆刪除