Latest web development tutorials

PHP 7 Session Options

PHP 7 New Features PHP 7 New Features

PHP 7 session_start () function takes an array as a parameter, you can override the php.ini configuration item's session.

This feature also introduces a new php.ini settings (session.lazy_write), by default is set to true, means that the session data is written only when changed.

In addition to the regular session configuration indicates that the item can also contain read_and_close options in this array. If the value of this option to TRUE, then the session will be closed immediately after the file has been read, so you can not change the data at the time of the session, to avoid unnecessary file locking.

Examples

The cache_limiter set to private, but after reading the session closes immediately.

Examples

<? php
session_start (& # 91;
'cache_limiter' => 'private' ,
'read_and_close' => true,
]);
?>

PHP 7 New Features PHP 7 New Features