當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Cookie::get_all方法代碼示例

本文整理匯總了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();
 }
開發者ID:lekoala,項目名稱:silverstripe-debugbar,代碼行數:8,代碼來源:DebugBarSilverStripeCollector.php

示例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;
 }
開發者ID:chillu,項目名稱:silverstripe-clockwork,代碼行數:29,代碼來源:SilverstripeDataSource.php

示例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));
 }
開發者ID:ivoba,項目名稱:silverstripe-framework,代碼行數:26,代碼來源:CookieTest.php


注:本文中的Cookie::get_all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。