本文整理汇总了PHP中Cake\Network\Session::start方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::start方法的具体用法?PHP Session::start怎么用?PHP Session::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Network\Session
的用法示例。
在下文中一共展示了Session::start方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* setUp method
*
* @return void
*/
public function setUp()
{
parent::setUp();
$this->View = new View();
$this->Session = new SessionHelper($this->View);
Session::start();
if (!Session::started()) {
Session::start();
}
$_SESSION = array('test' => 'info', 'Message' => array('flash' => array('element' => 'default', 'params' => array(), 'message' => 'This is a calling'), 'notification' => array('element' => 'session_helper', 'params' => array('title' => 'Notice!', 'name' => 'Alert!'), 'message' => 'This is a test of the emergency broadcasting system'), 'classy' => array('element' => 'default', 'params' => array('class' => 'positive'), 'message' => 'Recorded'), 'bare' => array('element' => null, 'message' => 'Bare message', 'params' => array())), 'Deeply' => array('nested' => array('key' => 'value')));
}
示例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: testSetLanguageWithSession
/**
* testSetLanguageWithSession method
*
* @return void
*/
public function testSetLanguageWithSession()
{
Session::start();
Session::write('Config.language', 'po');
$singular = $this->_singular();
$this->assertEquals('Po (translated)', $singular);
$plurals = $this->_plural();
$this->assertTrue(in_array('0 everything else (po translated)', $plurals));
$this->assertTrue(in_array('1 is 1 (po translated)', $plurals));
$this->assertTrue(in_array('2 is 2-4 (po translated)', $plurals));
$this->assertTrue(in_array('3 is 2-4 (po translated)', $plurals));
$this->assertTrue(in_array('4 is 2-4 (po translated)', $plurals));
$this->assertTrue(in_array('5 everything else (po translated)', $plurals));
$this->assertTrue(in_array('6 everything else (po translated)', $plurals));
$this->assertTrue(in_array('7 everything else (po translated)', $plurals));
$this->assertTrue(in_array('8 everything else (po translated)', $plurals));
$this->assertTrue(in_array('9 everything else (po translated)', $plurals));
$this->assertTrue(in_array('10 everything else (po translated)', $plurals));
$this->assertTrue(in_array('11 everything else (po translated)', $plurals));
$this->assertTrue(in_array('12 everything else (po translated)', $plurals));
$this->assertTrue(in_array('13 everything else (po translated)', $plurals));
$this->assertTrue(in_array('14 everything else (po translated)', $plurals));
$this->assertTrue(in_array('15 everything else (po translated)', $plurals));
$this->assertTrue(in_array('16 everything else (po translated)', $plurals));
$this->assertTrue(in_array('17 everything else (po translated)', $plurals));
$this->assertTrue(in_array('18 everything else (po translated)', $plurals));
$this->assertTrue(in_array('19 everything else (po translated)', $plurals));
$this->assertTrue(in_array('20 everything else (po translated)', $plurals));
$this->assertTrue(in_array('21 everything else (po translated)', $plurals));
$this->assertTrue(in_array('22 everything else (po translated)', $plurals));
$this->assertTrue(in_array('23 everything else (po translated)', $plurals));
$this->assertTrue(in_array('24 everything else (po translated)', $plurals));
$this->assertTrue(in_array('25 everything else (po translated)', $plurals));
Session::delete('Config.language');
}
示例4: 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'));
}
示例5: testSessionId
/**
* testSessionId method
*
* @return void
*/
public function testSessionId()
{
unset($_SESSION);
$Session = new SessionComponent($this->ComponentRegistry);
Session::start();
$this->assertEquals(session_id(), $Session->id());
}