1. Home
  2. Computing & Technology
  3. PHP / MySQL

Session_set_cookie_params () PHP Function

By , About.com Guide

Definition: Session_set_cookie_params () is used to set information about the session cookie, including the duration. It is phrased as session_set_cookie_params (seconds, optional_path, optional_domain, optional_security). This is not as effective as editing the php.ini file, and only lasts for the duration of the script, so you would need to call it on every page before session_start().
Also Known As: Set Session Cookie Duration
Examples:
//sets cookie to 1200 seconds or 20 mins
session_set_cookie_params(1200);
session_start();
Explore PHP / MySQL
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. PHP Functions
  5. Session Cookies - Session Cookie Length - Session Set Cookie Params

©2009 About.com, a part of The New York Times Company.

All rights reserved.