且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SESSION变量有问题......

更新时间:2023-09-29 10:08:28

_SESSION [''favcolor''] =''green'';
_SESSION[''favcolor''] = ''green'';


_SESSION [ ''animal''] =''cat'';
_SESSION[''animal''] = ''cat'';


_SESSION [''time''] = time();

/ /如果接受会话cookie,则工作

echo''< br />< a href =" page2.php"> page 2< / a>'';


//或者可以传递会话ID,如果需要的话

echo''< br />< a href =" page2.php?'' 。 SID。 ''">第2页< / a>'';

?>


文件2,page2.php


<?php

// page2.php


session_start();


echo''< br />欢迎来到第2页< br />'';


echo
_SESSION[''time''] = time();
// Works if session cookie was accepted
echo ''<br /><a href="page2.php">page 2</a>'';

// Or maybe pass along the session id, if needed
echo ''<br /><a href="page2.php?'' . SID . ''">page 2</a>'';
?>

File 2, page2.php

<?php
// page2.php

session_start();

echo ''<br />Welcome to page #2<br />'';

echo