| ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot |
session_gc(PHP 7 >= 7.1.0) session_gc — Perform session data garbage collection 説明
int session_gc
( void
)
session_gc() is used to perform session data GC(garbage collection). PHP does probability based session GC by default. Probability based GC works somewhat but it has few problems. 1) Low traffic sites' session data may not be deleted within the preferred duration. 2) High traffic sites' GC may be too frequent GC. 3) GC is performed on the user's request and the user will experience a GC delay. Therefore, it is recommended to execute GC periodically for production systems using, e.g., "cron" for UNIX-like systems. Make sure to disable probability based GC by setting session.gc_probability to 0. 返り値
session_gc() returns number of deleted session
data for success, Old save handlers do not return number of deleted session data, but only success/failure flag. If this is the case, number of deleted session data became 1 regardless of actually deleted data. 例
例1 session_gc() example for task managers like cron
<?php 例2 session_gc() example for user accessible script
<?php 参考
|
各種マニュアル:
PHPマニュアル |
PEARマニュアル |
Smarty(英語)マニュアル |
PHP-GTKマニュアル |
「session_gc - Perform session data garbage collection」をGoogle検索
|