当前位置: 首页>>代码示例>>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;未经允许,请勿转载。