0

a php login page will generate a session id which i require to be passed to a jsp web server. i also wish to use this session id on multiple web pages based on different platforms. how do i go ahead with it? also which technology, if not php, will be best suited for the same ?

4

2 回答 2

2

在不同的服务器和技术的上下文中,您不能真正使用相同的会话 ID。如果您想实现您所描述的内容,您应该查看Single sign on implementations,例如CAS,它为不同平台提供实现。

此外,你所要求的听起来是一个非常危险的想法。您永远不应单独使用会话 id 来识别用户,而应依赖上述技术来实现这一点。

于 2012-09-12T12:10:26.433 回答
0

您可以通过 URL 传递会话 ID

<?PHP $session_id = session_id(); ?>
<a href="nextpage.jsp?session_id=<?PHP echo htmlspecialchars($session_id); ?>">

然后返回使用

<a href="phppage.php?session_id={{whatever language mechanism to pass the $session_id back}}">

然后在接收PHP页面

<?PHP session_id($_GET['session_id']); ?>

虽然这会传递 ID(这是所要求的),但您将无法访问会话的内容,因此不确定该值或您的预期用途是什么。

于 2012-09-12T12:13:59.587 回答