session_set_cookie_params

void session_set_cookie_params(int cookie_lifetime, [string cookie_path], 
[string cookie_domain]) 

Sets session cookie parameters.

Returns:

void

Description:

Sets parameters for the cookie that holds the session information. This default data can be set in the PHP initialization file. Setting cookie information this way only lasts during the lifetime of the script in which the function is called. See setcookie() for an explanation of cookie parameters.

Version:

Existing since version 4.0

Example:

Set cookie lifetime to 60 minutes
session_start(); 
session_set_cookie_params(3600); 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.