当前位置: 首页>>代码示例>>PHP>>正文


PHP manager::kill_session方法代码示例

本文整理汇总了PHP中Core\Session\manager::kill_session方法的典型用法代码示例。如果您正苦于以下问题:PHP manager::kill_session方法的具体用法?PHP manager::kill_session怎么用?PHP manager::kill_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core\Session\manager的用法示例。


在下文中一共展示了manager::kill_session方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: report_usersessions_kill_session

/**
 * Kill user session.
 *
 * @param int $id
 * @return void
 */
function report_usersessions_kill_session($id)
{
    global $DB, $USER;
    $session = $DB->get_record('sessions', array('id' => $id, 'userid' => $USER->id), 'id, sid');
    if (!$session or $session->sid === session_id()) {
        // Do not delete the current session!
        return;
    }
    \core\session\manager::kill_session($session->sid);
}
开发者ID:evltuma,项目名称:moodle,代码行数:16,代码来源:locallib.php

示例2: session_kill

/**
 * Terminates one sessions, auth hooks are not executed.
 *
 * @deprecated since 2.6
 * @param string $sid session id
 */
function session_kill($sid)
{
    debugging('session_kill() is deprecated, use \\core\\session\\manager::kill_session() instead', DEBUG_DEVELOPER);
    \core\session\manager::kill_session($sid);
}
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:11,代码来源:deprecatedlib.php

示例3: while

 /**
  * To delete a host, we must delete all current sessions that users from
  * that host are currently engaged in.
  *
  * @param   string  $sessionidarray   An array of session hashes
  * @return  bool                      True on success
  */
 function end_local_sessions(&$sessionArray)
 {
     global $CFG;
     if (is_array($sessionArray)) {
         while ($session = array_pop($sessionArray)) {
             \core\session\manager::kill_session($session->session_id);
         }
         return true;
     }
     return false;
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:18,代码来源:auth.php

示例4: test_kill_session

 public function test_kill_session()
 {
     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->userid = 0;
     $record->sid = md5('pokus');
     $DB->insert_record('sessions', $record);
     $this->assertEquals(2, $DB->count_records('sessions'));
     \core\session\manager::kill_session($sid);
     $this->assertEquals(1, $DB->count_records('sessions'));
     $this->assertFalse($DB->record_exists('sessions', array('sid' => $sid)));
     $this->assertSame($userid, $USER->id);
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:25,代码来源:session_manager_test.php


注:本文中的Core\Session\manager::kill_session方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。