ini_set延长session存活时间为何失败?

zairwolfb 2006-07-19 05:09:33
在我把本机session的存活时间设置成10以后,我采用如下程序来尝试延长时间:

<?
ini_set("session.cookie_lifetime",3600*60);
session_start();
$_SESSION['a']=55;//第二次刷新之前注掉这一行
echo $_SESSION['a'];

然后10秒之后刷新却不显示出来了。为什么?
...全文
233 14 打赏 收藏 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
颓废的老猫 2006-07-22
  • 打赏
  • 举报
回复
学习
zeroleonhart 2006-07-21
  • 打赏
  • 举报
回复
<?php

/* set the cache limiter to 'private' */

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

/* set the cache expire to 30 minutes */
session_cache_expire(30);
$cache_expire = session_cache_expire();

/* start the session */

session_start();

echo "The cache limiter is now set to $cache_limiter<br />";
echo "The cached session pages expire after $cache_expire minutes";
?>
zairwolfb 2006-07-20
  • 打赏
  • 举报
回复
不可能。那个本身的值就是180
iasky 2006-07-20
  • 打赏
  • 举报
回复
mark
zeroleonhart 2006-07-19
  • 打赏
  • 举报
回复
Maybe session_cache_expire
zairwolfb 2006-07-19
  • 打赏
  • 举报
回复
那怎么设置session的?
zeroleonhart 2006-07-19
  • 打赏
  • 举报
回复
Faint....
zeroleonhart 2006-07-19
  • 打赏
  • 举报
回复
I konw.....

ini_set("session.cookie_lifetime",3600*60);

it is used by setting the lifetime of cookie,not the lifetime of session.....
Gdj 2006-07-19
  • 打赏
  • 举报
回复
1. 检查ini_set的返回值
2. 检查session.gc_maxlifetime的值
zairwolfb 2006-07-19
  • 打赏
  • 举报
回复
这点我还是知道的……电脑都从起过的。无效……而且maxlifetime本身就没动它。
zeroleonhart 2006-07-19
  • 打赏
  • 举报
回复
PHP may affect what you change in php.ini after it restarted.
zairwolfb 2006-07-19
  • 打赏
  • 举报
回复
什么意思?
zeroleonhart 2006-07-19
  • 打赏
  • 举报
回复
Restart Webserver(PHP).
zairwolfb 2006-07-19
  • 打赏
  • 举报
回复
1、下文通过ini_get得到值是正确的。

2、值为session.gc_maxlifetime = 1440。有影响么?

21,889

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧