search
Homephp教程php手册ecshop后台登录超时session过期的解决办法

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

Jun 13, 2016 am 09:46 AM
ecshopsessionMethodDiscoverBackstageuserLog inofmy ownsolvetime outExpired

可能有不少用户会发现自己的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秒以后过期。

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft