Álv*_*lez 44
随机过期是几个应用程序共享的会话数据目录的典型症状:具有最短session.gc_maxlifetime时间的应用程序很可能从其他应用程序中删除数据.原因:
内置文件处理程序不跟踪谁拥有哪个会话文件(它只是将文件名与会话ID匹配):

我的建议是为应用程序配置一个私有自定义会话目录.这可以通过session_save_path()函数或设置session.save_path配置指令来完成.请查看您的框架文档,了解有关如何在您自己的代码库中执行此操作的详细信息.
Doc*_*ext 15
Debian使用cron作业以安全的方式自动使会话过期.如果您使用的是Debian,请查看/etc/cron.d/php5.
您可以使用它来根据您的要求使您的应用程序兼容.您必须根据您的系统进行一些更改
// Get the current Session Timeout Value
$currentTimeoutInSecs = ini_get(’session.gc_maxlifetime’);
更改会话超时值
// Change the session timeout value to 30 minutes  // 8*60*60 = 8 hours
ini_set(’session.gc_maxlifetime’, 30*60);
//————————————————————————————–
// php.ini setting required for session timeout.
ini_set(‘session.gc_maxlifetime’,30);
ini_set(‘session.gc_probability’,1);
ini_set(‘session.gc_divisor’,1);
//if you want to change the  session.cookie_lifetime.
//This required in some common file because to get the session values in whole application we need to        write session_start();  to each file then only will get $_SESSION global variable values.
$sessionCookieExpireTime=8*60*60;
session_set_cookie_params($sessionCookieExpireTime);
session_start();
// Reset the expiration time upon page load //session_name() is default name of session PHPSESSID
if (isset($_COOKIE[session_name()]))
    setcookie(session_name(), $_COOKIE[session_name()], time() + $sessionCookieExpireTime, “/”);
    //————————————————————————————–
    //To get the session cookie set param values.
    $CookieInfo = session_get_cookie_params();
    echo “<pre>”;
    echo “Session information session_get_cookie_params function :: <br />”;
    print_r($CookieInfo);
    echo “</pre>”;
| 归档时间: | 
 | 
| 查看次数: | 77928 次 | 
| 最近记录: |