本文整理汇总了PHP中CakeSession::init方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeSession::init方法的具体用法?PHP CakeSession::init怎么用?PHP CakeSession::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CakeSession
的用法示例。
在下文中一共展示了CakeSession::init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: userAgent
/**
* Get / Set the user agent
*
* @param string $userAgent Set the user agent
* @return string Current user agent
*/
public static function userAgent($userAgent = null)
{
if ($userAgent) {
self::$_userAgent = $userAgent;
}
if (empty(self::$_userAgent)) {
CakeSession::init(self::$path);
}
return self::$_userAgent;
}
示例2: testAuthorizeFor_Admin
/**
* @return void
*/
public function testAuthorizeFor_Admin()
{
// can see link to the project for system admin.
CakeSession::id('testsess');
CakeSession::init();
CakeSession::write('user_id', 1);
$project = ClassRegistry::init('Project')->findById(1);
$result = $this->Candy->authorize_for(array('controller' => 'members', 'action' => 'edit'), $project);
$this->assertTrue($result);
}
示例3: read
* @param mixed $id The key of the value to read
* @return mixed The value of the key or false if it does not exist
*/
public function read($id);
/**
* Helper function called on write for sessions.
*
* @param integer $id ID that uniquely identifies session in database
* @param mixed $data The value of the data to be saved.
* @return boolean True for successful write, false otherwise.
*/
public function write($id, $data);
/**
* Method called on the destruction of a session.
*
* @param integer $id ID that uniquely identifies session in database
* @return boolean True for successful delete, false otherwise.
*/
public function destroy($id);
/**
* Run the Garbage collection on the session storage. This method should vacuum all
* expired or dead sessions.
*
* @param integer $expires Timestamp (defaults to current time)
* @return boolean Success
*/
public function gc($expires = null);
}
// Initialize the session
CakeSession::init();
示例4: userAgent
/**
* Get / Set the user agent
*
* @param string|null $userAgent Set the user agent
*
* @return string Current user agent.
*/
public static function userAgent($userAgent = NULL)
{
if ($userAgent) {
static::$_userAgent = $userAgent;
}
if (empty(static::$_userAgent)) {
CakeSession::init(static::$path);
}
return static::$_userAgent;
}