本文整理汇总了PHP中Cake\Network\Session::id方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::id方法的具体用法?PHP Session::id怎么用?PHP Session::id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Network\Session
的用法示例。
在下文中一共展示了Session::id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: id
/**
* Get/Set the session id.
*
* When fetching the session id, the session will be started
* if it has not already been started. When setting the session id,
* the session will not be started.
*
* @param string $id Id to use (optional)
* @return string The current session id.
*/
public function id($id = null)
{
if ($id === null) {
$session = $this->_session;
$session->start();
return $session->id();
}
$this->_session->id($id);
}
示例2: id
/**
* Get/Set the session id.
*
* When fetching the session id, the session will be started
* if it has not already been started. When setting the session id,
* the session will not be started.
*
* @param string $id Id to use (optional)
* @return string The current session id.
*/
public function id($id = null)
{
if (empty($id)) {
Session::start();
}
return Session::id($id);
}
示例3: testDestroy
/**
* testDestroy method
*
* @return void
*/
public function testDestroy()
{
$session = new Session();
$session->start();
$session->write('bulletProof', 'invincible');
$session->id('foo');
$session->destroy();
$this->assertFalse($session->check('bulletProof'));
}
示例4: testStatelessAuthNoSessionStart
/**
* testStatelessAuthNoSessionStart method
*
* @return void
*/
public function testStatelessAuthNoSessionStart()
{
if (Session::id()) {
session_destroy();
Session::$id = null;
}
$event = new Event('Controller.startup', $this->Controller);
AuthComponent::$sessionKey = false;
$this->Auth->config('authenticate', ['Basic' => array('userModel' => 'AuthUsers')]);
$this->Controller->request['action'] = 'admin_add';
$this->Controller->request->env('PHP_AUTH_USER', 'mariano');
$this->Controller->request->env('PHP_AUTH_PW', 'cake');
$result = $this->Auth->startup($event);
$this->assertNull($result);
$this->assertNull(Session::id());
}