开发者

how to get my current session usage in codeigniter

hi i am using codeigniter .

i know the size of session is 4kb.

i want to get the current session usage in my site ,

i am looking for a function like like get_session_c开发者_JS百科urrent_usage() (this is created by me ;))

instead of Saving Session Data to a Database . i would like to get my current session usage and if it is near 4kb , i want to destroy it . please help.................


if you store the session in a plain cookie, the classic way of codeigniter just read the raw cookie and check the length of the cookie:

$cookie = $_COOKIE['your_session_name'];
$cookieSize = strlen($cookie);
if($cookieSize > $CookieSizeLimit) {
    // do something
}

Why do you want to destroy the cookie after a set size? just curious

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜