本文整理汇总了PHP中ilSession::_writeData方法的典型用法代码示例。如果您正苦于以下问题:PHP ilSession::_writeData方法的具体用法?PHP ilSession::_writeData怎么用?PHP ilSession::_writeData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilSession
的用法示例。
在下文中一共展示了ilSession::_writeData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBasicSessionBehaviour
/**
* @group IL_Init
*/
public function testBasicSessionBehaviour()
{
global $ilUser;
include_once "./Services/Authentication/classes/class.ilSession.php";
$result = "";
ilSession::_writeData("123456", "Testdata");
if (ilSession::_exists("123456")) {
$result .= "exists-";
}
if (ilSession::_getData("123456") == "Testdata") {
$result .= "write-get-";
}
$duplicate = ilSession::_duplicate("123456");
if (ilSession::_getData($duplicate) == "Testdata") {
$result .= "duplicate-";
}
ilSession::_destroy("123456");
if (!ilSession::_exists("123456")) {
$result .= "destroy-";
}
ilSession::_destroyExpiredSessions();
if (ilSession::_exists($duplicate)) {
$result .= "destroyExp-";
}
ilSession::_destroyByUserId($ilUser->getId());
if (!ilSession::_exists($duplicate)) {
$result .= "destroyByUser-";
}
$this->assertEquals("exists-write-get-duplicate-destroy-destroyExp-destroyByUser-", $result);
}
示例2: _duplicate
/**
* Duplicate session
*
* @param string session id
* @return string new session id
*/
static function _duplicate($a_session_id)
{
global $ilDB;
// Create new session id
$new_session = $a_session_id;
do {
$new_session = md5($new_session);
$q = "SELECT * FROM usr_session WHERE " . "session_id = " . $ilDB->quote($new_session, "text");
$res = $ilDB->query($q);
} while ($ilDB->fetchAssoc($res));
$query = "SELECT * FROM usr_session " . "WHERE session_id = " . $ilDB->quote($a_session_id, "text");
$res = $ilDB->query($query);
while ($row = $ilDB->fetchObject($res)) {
ilSession::_writeData($new_session, $row->data);
return $new_session;
}
return false;
}
示例3: write
/**
* Writes serialized session data to the database.
*
* @param integer $session_id session id
* @param string $data session data
*/
public function write($session_id, $data)
{
return ilSession::_writeData($session_id, $data);
}