本文整理匯總了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);
}