Session_Start of PHP Session control

Source: Internet
Author: User
Tags php session

How does the Session_Start () session of the PHP conversation control initialize?
声明一个全局数组$_SESSION,映射寄存在内存的session数据。如果session文件已经存在,并且保存有session数据,session_start()则会读取session数据,填入$_SESSION中,开始一个新的session生命周期。
Session initialization in php.ini related parameters
session.auto_start = 0 默认值为0如果开启(值改为1),则默认在每个页面执行session_start()
Session_Start ()
启动新会话或者重用现有会话bool session_start ([ array $options = [] ] )参数:    $options参数是一个关联数组,数组中的值会覆盖会话配置指示中的配置项。    注:此数组中无需包含sesssion. 前缀。    $options常用指定选项        1.设置cookie的有效时间为1天                  sesstion_start([‘cookie_lifetime‘ => 86400])        2.如果确定不修改会话中的数据,在会话文件读取后立即关闭它,        来避免由于会话文件加锁导致其他页面阻塞。        sessioin_start([            ‘cookie_lifetime‘ => 86400,            ‘read_and_close‘ => true        ])返回值:    类型:bool        成功:true        失败:false
Description
初始化session,标志着session生命周期的开始。
Precautions:
要使用基于cookie的会话,必须在输出之前调用session_start()

Session_Start of PHP Session control

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.