php 里跨页面 session 丢失了 怎么办? 急!!!!!!
第一个页面:set.php<?phpsession_start();session_register("name");$_SESSION["name"]="sname";...
第一个页面:set.php
<?php
session_start();
session_register("name");
$_SESSION["name"]="sname";
echo "<a href=display.php>display session name is ".$_SESSION["name"]."</a>";
?>
第二个页面:display.php
<?php
session_start();
echo "session name:".$_SESSION['name'];
?>
php.ini 的session 节:
[Session]
; Handler used to store/retrieve data.
session.save_handler = files
; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
session.save_path = D:\PHPWEBROOT\tem
; Whether to use cookies.
session.use_cookies = 1
; This option enables administrators to make their users invulnerable to
; attacks which involve passing session ids in URLs; defaults to 0.
; session.use_only_cookies = 1
; Name of the session (used as cookie name).
session.name = PHPSESSID 展开
<?php
session_start();
session_register("name");
$_SESSION["name"]="sname";
echo "<a href=display.php>display session name is ".$_SESSION["name"]."</a>";
?>
第二个页面:display.php
<?php
session_start();
echo "session name:".$_SESSION['name'];
?>
php.ini 的session 节:
[Session]
; Handler used to store/retrieve data.
session.save_handler = files
; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
session.save_path = D:\PHPWEBROOT\tem
; Whether to use cookies.
session.use_cookies = 1
; This option enables administrators to make their users invulnerable to
; attacks which involve passing session ids in URLs; defaults to 0.
; session.use_only_cookies = 1
; Name of the session (used as cookie name).
session.name = PHPSESSID 展开
3个回答
展开全部
第二页面里不用加session_start(); 了把?去掉试下
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
session_start();
前面不是已经start;了吗?
这样不是restart?
呵呵
其实我也是新手
前面不是已经start;了吗?
这样不是restart?
呵呵
其实我也是新手
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询