Is it possible to set session expiration based on a specific time duration in PHP?
Yes, it is possible to set session expiration based on a specific time duration in PHP by setting the session cookie expiration time using the `session_set_cookie_params()` function. This function allows you to specify the lifetime of the session cookie, which in turn determines how long the session will last.
// Set session cookie expiration time to 1 hour
session_set_cookie_params(3600);
session_start();
Keywords
Related Questions
- What are some best practices for defining meta elements in PHP to avoid validation errors?
- What are some best practices for displaying dates in PHP to ensure language consistency across posts?
- How can error handling be improved in the provided PHP script to accurately determine the reachability of a website?