1
我不完全明白session_start
是如何工作的?例如,這裏有一個名爲腳本:session_start如何知道是否恢復或啓動會話?
tester.php
<html>
<body> <head> <title> tester.php </title> </head>
<?php
session_start();
$_SESSION['Mir Taqi Mir'] = "Dekh toh dil ke jaan se uthta hai,yeh dhuan sa kahaan se uthta hai";
?>
<a href='./try.php'>Click to follow</a>
</body>
</html>
和一個名爲try.php
腳本:
session_start();
if(isset($_SESSION['Mir Taqi Mir']))
{
echo "Value of the session variable :".$_SESSION['Mir Taqi Mir'];
}
當我從tester.php
隨之回落至try.php
如何session_start
知道它必須恢復會議而不開始新會話?
documentation陳述:session_start() creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie.
什麼標識符?我不明白。
Mehdi Hasan ????? – asprin 2013-03-14 06:15:33
@asprin是啊! Mehdi Hasan – 2013-03-14 06:16:35
可能的重複[如何知道開始一個新的會話](http://stackoverflow.com/questions/14382738/how-does-php-know-to-start-a-new-session) – user 2014-03-17 10:33:23