本文整理汇总了PHP中Core\Session\manager::kill_all_sessions方法的典型用法代码示例。如果您正苦于以下问题:PHP manager::kill_all_sessions方法的具体用法?PHP manager::kill_all_sessions怎么用?PHP manager::kill_all_sessions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core\Session\manager
的用法示例。
在下文中一共展示了manager::kill_all_sessions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: session_kill_all
/**
* Terminates all sessions, auth hooks are not executed.
* Useful in upgrade scripts.
*
* @deprecated since 2.6
*/
function session_kill_all()
{
debugging('session_kill_all() is deprecated, use \\core\\session\\manager::kill_all_sessions() instead', DEBUG_DEVELOPER);
\core\session\manager::kill_all_sessions();
}
示例2: test_kill_all_sessions
public function test_kill_all_sessions()
{
global $DB, $USER;
$this->resetAfterTest();
$this->setAdminUser();
$userid = $USER->id;
$sid = md5('hokus');
$record = new \stdClass();
$record->state = 0;
$record->sid = $sid;
$record->sessdata = null;
$record->userid = $userid;
$record->timecreated = time() - 60 * 60;
$record->timemodified = time() - 30;
$record->firstip = $record->lastip = '10.0.0.1';
$DB->insert_record('sessions', $record);
$record->sid = md5('hokus2');
$DB->insert_record('sessions', $record);
$record->userid = 0;
$record->sid = md5('pokus');
$DB->insert_record('sessions', $record);
$this->assertEquals(3, $DB->count_records('sessions'));
\core\session\manager::kill_all_sessions();
$this->assertEquals(0, $DB->count_records('sessions'));
$this->assertSame(0, $USER->id);
}