本文整理汇总了PHP中Cookie::get_all方法的典型用法代码示例。如果您正苦于以下问题:PHP Cookie::get_all方法的具体用法?PHP Cookie::get_all怎么用?PHP Cookie::get_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cookie
的用法示例。
在下文中一共展示了Cookie::get_all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCookieData
public static function getCookieData()
{
// On 3.1, Cookie::get_all does not exist
if (!method_exists('Cookie', 'get_all')) {
return $_COOKIE;
}
return Cookie::get_all();
}
示例2: resolve
/**
* The entry-point. called by Clockwork itself.
* @param Request $request
* @return \Clockwork\Request\Request
*/
function resolve(Request $request)
{
// Retrieve the timeline
$timeline = Injector::inst()->get('ClockworkTimeline');
$timeline->finalize();
$request->timelineData = $timeline->toArray();
// Retrieve the query log
$db = DB::getConn();
if ($db instanceof DatabaseProxy) {
$request->databaseQueries = $db->getQueries();
}
// Retrieve the log
$log = Injector::inst()->get('ClockworkLog');
$request->log = $log->toArray();
// Fill in the rest of the request - these may not be finalized yet when the PhpDataSource sees them
$request->cookies = \Cookie::get_all();
$request->sessionData = \Session::get_all();
// Give some knowledge about the controller if we have it
if (isset(self::$controller)) {
$request->controller = self::$controller;
}
// TODO: routing
return $request;
}
示例3: testExistingVersusNew
/**
* Test that we can distinguish between vars that were loaded on instantiation
* and those added later
*/
public function testExistingVersusNew()
{
//load with a cookie
$cookieJar = new CookieJar(array('cookieExisting' => 'i woz here'));
Injector::inst()->registerService($cookieJar, 'Cookie_Backend');
//set a new cookie
Cookie::set('cookieNew', 'i am new');
//check we can fetch new and old cookie values
$this->assertEquals('i woz here', Cookie::get('cookieExisting'));
$this->assertEquals('i woz here', Cookie::get('cookieExisting', false));
$this->assertEquals('i am new', Cookie::get('cookieNew'));
//there should be no original value for the new cookie
$this->assertEmpty(Cookie::get('cookieNew', false));
//change the existing cookie, can we fetch the new and old value
Cookie::set('cookieExisting', 'i woz changed');
$this->assertEquals('i woz changed', Cookie::get('cookieExisting'));
$this->assertEquals('i woz here', Cookie::get('cookieExisting', false));
//check we can get all cookies
$this->assertEquals(array('cookieExisting' => 'i woz changed', 'cookieNew' => 'i am new'), Cookie::get_all());
//check we can get all original cookies
$this->assertEquals(array('cookieExisting' => 'i woz here'), Cookie::get_all(false));
}