1. Configure role of cookie domain name, and the effective time
$currentCookieParams = session_get_cookie_params();
$ Root domain = '.study.com';
session_set_cookie_params(
$currentCookieParams["lifetime"],
$currentCookieParams["path"],
$ Root domain,
$currentCookieParams["secure"],
$currentCookieParams["httponly"]
);
session_name('mysessionname');
session_start();
setcookie('zhangsan', 12314, time() + 3600, '/', $rootDomain);
print_r($_COOKIE);
2. Profiles
session.auto_start | Off | O |
session.cache_expire | 180 | Effective time |
session.cache_limiter | nocache | nocache |
session.cookie_domain | .study.com | Scope |
session.cookie_httponly | Off | Prohibit jS get cookie |
session.cookie_lifetime | 0 | Specify the number of seconds to send a cookie to the browser of the life cycle. A value of 0 means "until the browser is closed." The default is 0 |
session.cookie_path | / | session storage path |
session.cookie_secure | Off | Specifies whether the cookie is sent only through a secure connection. The default is off |
session.gc_divisor | 1000 | Garbage collection configuration |
session.gc_maxlifetime | 1440 | Garbage collection configuration |
session.gc_probability | 1 | Garbage collection configuration |
session.lazy_write | On | On |
session.name | MY_SESSID | Module Name |
session.referer_check | no value | no value |
session.save_handler | files | Data storage methods |
session.save_path | /tmp/session | Data storage location |
session.serialize_handler | php_serialize | storing data session, the data format |
session.sid_bits_per_character | 5 | 5 |
session.sid_length | 26 | 26 |
session.upload_progress.cleanup | On | On |
session.upload_progress.enabled | On | On |
session.upload_progress.freq | 1% | 1% |
session.upload_progress.min_freq | 1 | 1 |
session.upload_progress.name | PHP_SESSION_UPLOAD_PROGRESS | PHP_SESSION_UPLOAD_PROGRESS |
session.upload_progress.prefix | upload_progress_ | upload_progress_ |
session.use_cookies | On | Specifies whether the client with a cookie to store the session ID |
session.use_only_cookies | On | On |
session.use_strict_mode | Off | Strict mode is turned on |
session.use_trans_sid | Specifies whether to enable transparent SID |