本文整理汇总了PHP中adodb_sess_gc函数的典型用法代码示例。如果您正苦于以下问题:PHP adodb_sess_gc函数的具体用法?PHP adodb_sess_gc怎么用?PHP adodb_sess_gc使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了adodb_sess_gc函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: limpiar
function limpiar()
{
if (rand() % 100 == 0) {
adodb_sess_gc(100);
}
return;
}
示例2: print_r
} else {
$_SESSION['MONKEY'][0] += 1;
}
if (!isset($_GET['nochange'])) {
@($_SESSION['AVAR'] += 1);
}
### START DISPLAY
print "<h3>PHP " . PHP_VERSION . "</h3>";
print "<p><b>\$_SESSION['AVAR']={$_SESSION['AVAR']}</b></p>";
print "<hr /> <b>Cookies</b>: ";
print_r($_COOKIE);
var_dump($_SESSION['MONKEY']);
### RANDOMLY PERFORM Garbage Collection
### In real-production environment, this is done for you
### by php's session extension, which calls adodb_sess_gc()
### automatically for you. See php.ini's
### session.cookie_lifetime and session.gc_probability
if (rand() % 5 == 0) {
print "<hr /><p><b>Garbage Collection</b></p>";
adodb_sess_gc(10);
if (rand() % 2 == 0) {
print "<p>Random own session destroy</p>";
session_destroy();
}
} else {
$DB = ADODB_Session::_conn();
$sessk = $DB->qstr('%AZ' . rand() . time());
$olddate = $DB->DBTimeStamp(time() - 30 * 24 * 3600);
$rr = $DB->qstr(rand());
$DB->Execute("insert into {$options['table']} (sesskey,expiry,expireref,sessdata,created,modified) values ({$sessk},{$olddate}, {$rr},'',{$olddate},{$olddate})");
}
示例3: print_r
</tr>
<tr>
<td valign="top">
<?php
echo "<h3>\$USERID = " . $USERID . "</h3>";
echo "<p><b>\$_SESSION['foo'] = " . $_SESSION['foo'] . "</b></p>";
echo "<p><b>\$_SESSION['baz'] = " . $_SESSION['baz'] . "</b></p>";
echo "<p><b>\$_SESSION['hiya'] = " . $_SESSION['hiya'] . "</b></p>";
echo "<hr> <b>Cookies</b>: ";
print_r($_COOKIE);
echo "<br><hr> <b>Sessions</b>: ";
print_r($_SESSION);
if (mt_rand() % 2 == 0) {
echo "<hr><p><b>Garbage Collection</b></p>";
$time = time() + 6400;
adodb_sess_gc($time);
} else {
if (mt_rand() % 2 == 0) {
echo "<hr><p><b>Session destroy</b></p>";
session_destroy();
} else {
echo "<hr><p><b>Normal Execution</b></p>";
}
}
?>
<br>
</td>
</tr>
<tr>
<td>
<div align="center">Reload/Refresh the page multiple times. You should randomly see "Garbage Collection", "Session Destroyed" or "Normal Execution".