Home > php教程 > php手册 > body text

ecshop后台登录超时session过期的解决办法

WBOY
Release: 2016-06-13 09:46:35
Original
1293 people have browsed it

可能有不少用户会发现自己的ecshop经常会使用关就超时了,这个问题解决办法有很多种,我们可以直接在ecsho中进行修改,具体方法如下

在includescls_session.php中修改

 代码如下 复制代码

var $max_life_time = 1440;

// SESSION 过期时间、单位秒这段代码中的数字。此数字单位为秒,前台登录和后台登陆都是调用这里设置的时间。

2 关于在后台编辑产品经常由于时间长而超时,可以在登录的时候,勾起“请保存我这次登录信息”就可以不提示超时了,或者直接修改admintemplateslogin.html,,让页面默认选中这一项!现在的新版本,对安全打高了一些,几乎是5分钟没有操作后台就重新登陆,有没有办法可以改掉因为只有3分钟,所以我们往往在录入过程中就超时了,所以我们需要增加超时时间。

修改方法如下:

includes/init.php
api/init.php
admin/includes/init.php
wap/includes/init.php

将以上这几个文件中,找到下面的代码

 代码如下 复制代码

@ini_set(’session.cache_expire’, 180);//单位秒

当然除了上面方法我们还可以修改php配置文件来操作了

继续PHP中的Session话题,在PHP中主要通过设置session.gc_maxlifetime来设定Session的生存周期。例如:

 代码如下 复制代码

        ini_set('session.gc_maxlifetime', 3600); //设置时间
    ini_get('session.gc_maxlifetime');//得到ini中设定值
    ?>

下面提供一个别人封装好的函数,但是我没有测试过,仅供参考:

 代码如下 复制代码

        function start_session($expire = 0)
    {
    if ($expire == 0) {
    $expire = ini_get('session.gc_maxlifetime');
    } else {
    ini_set('session.gc_maxlifetime', $expire);
    }
    
    if (empty($_COOKIE['PHPSESSID'])) {
    session_set_cookie_params($expire);
    session_start();
    } else {
    session_start();
    setcookie('PHPSESSID', session_id(), time() + $expire);
    }
    }
    ?>

使用方法:

    加入start_session(600);//600秒以后过期。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!