2018-06-22 08:26:30

  session指的是默认php提供的文件session形式

  当前我的认识是,php并不记录session的过期时间,但是php.ini中有session的垃圾回收机制

; Defines the probability that the 'garbage collection' process is started
; on every session initialization. The probability is calculated by using
; gc_probability/gc_divisor. Where session.gc_probability is the numerator
; and gc_divisor is the denominator in the equation. Setting this value to
; when the session.gc_divisor value is will give you approximately a % chance
; the gc will run on any give request.
; Default Value:
; Development Value:
; Production Value:
; http://php.net/session.gc-probability
session.gc_probability = ; Defines the probability that the 'garbage collection' process is started on every
; session initialization. The probability is calculated by using the following equation:
; gc_probability/gc_divisor. Where session.gc_probability is the numerator and
; session.gc_divisor is the denominator in the equation. Setting this value to
; when the session.gc_divisor value is will give you approximately a % chance
; the gc will run on any give request. Increasing this value to will give you
; a 0.1% chance the gc will run on any give request. For high volume production servers,
; this is a more efficient approach.
; Default Value:
; Development Value:
; Production Value:
; http://php.net/session.gc-divisor
session.gc_divisor =

并不是每次都精确的,当前的配置session_start()触发session回收的概率为1/1000,应为每次读取session都会更新这个session文件的修改时间,通过检测修改时间来检测是否过期,也就是即使设置了很短的session过期时间但是这个session很可能在预定的过期时间后仍然存在。

后台session设置了过期时间,为什么测试后发现可以精确的过期,应为浏览器端请求在session过期后,未携带phpsession做的请求,所以php会重新生成一个sessionid,这说明session的过期时间并不可靠

PHPSESSID=8s0dgoui98b623tviibb9dm0pt; path=/; domain=localhost; Expires=Fri,  Jun  :: GMT;

用一个旧的cookie把过期时间延长超过后台设置的session过期时间后发现仍可访问

php session 测试的更多相关文章

  1. 浅谈session测试

    Session 是用于保持状态的基于 Web 服务器的方法,在 Web 服务器上保持用户的状态信息供在任何时间从任何页访问.Session 允许通过将对象存储在 Web 服务器的内存中在整个用户会话过 ...

  2. flask中的session cookie 测试 和 项目中的用户状态保持

    # -*- coding:utf-8 -*- # Author: json_steve from flask import Flask, current_app, make_response, req ...

  3. 【OF框架】框架Cache/Session在负载均衡部署时,切换Memory/Redis测试

    一.切换Memory/Redis 第一步:安装运行Redis服务,获得连接参数. 第二步:在appsettings.json中配置 EnableRedisCache 和 Redisconnection ...

  4. Redis安装及实现session共享

    一.Redis介绍 1.redis是key-value的存储系统,属于非关系型数据库 2.特点:支持数据持久化,可以让数据在内存中保存到磁盘里(memcached:数据存在内存里,如果服务重启,数据会 ...

  5. DFX 安全测试-- 告诉你什么是XSS、sql注入?POST和GET的区别....

    1.用户权限测试 (1) 用户权限控制 1) 用户权限控制主要是对一些有权限控制的功能进行验证 2) 用户A才能进行的操作,B是否能够进行操作(可通过窜session,将在下面介绍) 3)只能有A条件 ...

  6. .Net分布式架构(二):基于Redis的Session共享

    一:Session简介 Session是什么呢?简单来说就是服务器给客户端的一个编号.当一台web服务器运行时,可能有若干个用户浏览正在运正在这台服务器上的网站.当每个用户首次与这台web服务器建立连 ...

  7. 使用EasyMock对Servlet进行简单的测试

    这是一个WebProject,但不需配置web.xml,因为EasyMock用不上它 首先是用到的实体类User.java package com.jadyer.model; public class ...

  8. 监听器应用【统计网站人数、自定义session扫描器、踢人小案例】

    从第一篇已经讲解过了监听器的基本概念,以及Servlet各种的监听器.这篇博文主要讲解的是监听器的应用. 统计网站在线人数 分析 我们在网站中一般使用Session来标识某用户是否登陆了,如果登陆了, ...

  9. Hibernate中Session之get和load方法的真正区别

    最近在学习SHH框架中的hibernate,对Session的get和load方法,有点混不清楚,不知道区别在哪,或者对它们的区别感触不深.所以百度了一下,结果问题来了.百度的结果和实际测试的结果出入 ...

随机推荐

  1. 旧文备份:VC中嵌入NASM编写的汇编函数

    在公司开发的RT下没法使用C库,并且替代库函数没有几个,需要用到setjmp和longjmp函数,没办法,只能自己想办法了,上sourceforge淘换到一个小日本的工程,提供这两个函数的替代源码,名 ...

  2. 折腾Vscode写C++

    一直以来都是用Sublime Text3写C/C++.因为ST配置简单,轻量.闲来没事才弄一弄. 1. 新建文件夹C++Code,并且再建立一个bulid文件夹来放要写的代码. ​ 2. 在Vscod ...

  3. c#字符显示转换{0:d} string.Format()

    这一篇实际和前几个月写的没什么本质上的区别.但是这篇更明确一点,学起来easy c#字符显示转换{0:d} C#:String.Format数字格式化输出 : int a = 12345678; // ...

  4. scrapy--ipproxy

    不要急于求成,你只要做的是比昨天的你更优秀一点 --匿名 今天给大家讲一下--IpProxy,由于从"http://www.xicidaili.com/nn"爬取,以下是我转载的博 ...

  5. Codeforces Round #460 (Div. 2): D. Substring(DAG+DP+判环)

    D. Substring time limit per test 3 seconds memory limit per test 256 megabytes input standard input ...

  6. 008---Django的模版层

    python的模板:HTML代码+模板语法 <!--模版语法之变量--> <h1>Index </h1> <p>{{ name }}</p> ...

  7. K-均值聚类——电影类型

    K-均值聚类 K-均值算法试图将一系列样本分割成K个不同的类簇(其中K是模型的输入参数),其形式化的目标函数称为类簇内的方差和(within cluster sum of squared errors ...

  8. 8 定制10MINs 3

    1. <div class="ui inverted red basic segment"> <h3 class="ui header"> ...

  9. Codeforces 787D Legacy 线段树 最短路

    题意: 有\(n(1 \leq n \leq 10^5)\)个点,\(q(1 \leq q \leq 10^5)\)条路和起点\(s\) 路有三种类型: 从点\(v\)到点\(u\)需要花费\(w\) ...

  10. SetConsoleCtrlHandler

    Excerpt: Registering a Control Handler Function   This is an example of the SetConsoleCtrlHandler fu ...