Home > Backend Development > PHP Tutorial > php设立session过期

php设立session过期

WBOY
Release: 2016-06-13 12:05:01
Original
859 people have browsed it

php设置session过期

ini_set('session.use_only_cookies', 1);?

ini_set('session.gc_maxlifetime', 600)

session_start()

setcookie(session_name(), session_id(), time() + 600);

?

session.use_only_cookies用于设置只允许使用cookie传值而不允许url传值

int_set需放置在session_start()上

setcookie放置在session_start()下面

?

session的过期时间并不是精准的,如100次请求,php删除一次session,即存在一定的概率。所以存在时间上的误差。

?

文章在独立博客地址:http://www.fsech.com/code/php/4.php

Related labels:
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template