这样做没有意义...
使用 SESSION 和 GET
用户填写一个发布到的表单reply.php
回复.php
<?php
session_start();
$_SESSION['userid'] = strtotime('now'); # don't use this as a user id, it's just an example
#add something to db using generated userid
header("location: replies.php?userid=".$_SESSION['userid']);
?>
回复.php
<?php
#session_start(); don't even need it
# get something from db where userid=".$_GET['userid'];
# output something
?>
正常使用 SESSION
用户填写一个发布到的表单reply.php
回复.php
<?php
session_start();
$_SESSION['userid'] = strtotime('now'); # don't use this as a user id, it's just an example
#add something to db using generated userid
header("location: replies.php");
?>
回复.php
<?php
session_start();
# get something from db where userid=".$_SESSION['userid'];
# output something
?>
当您在会话中使用该变量时,无需传递该变量。