当前位置: 首页>>代码示例>>PHP>>正文


PHP SimpleCookieJar::setCookie方法代码示例

本文整理汇总了PHP中SimpleCookieJar::setCookie方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleCookieJar::setCookie方法的具体用法?PHP SimpleCookieJar::setCookie怎么用?PHP SimpleCookieJar::setCookie使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleCookieJar的用法示例。


在下文中一共展示了SimpleCookieJar::setCookie方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCookieJarIsSentToRequest

 function testCookieJarIsSentToRequest()
 {
     $jar = new SimpleCookieJar();
     $jar->setCookie('a', 'A');
     $request =& new MockSimpleHttpRequest();
     $request->setReturnReference('fetch', $this->_createStandardResponse());
     $request->expectOnce('readCookiesFromJar', array($jar, '*'));
     $agent =& $this->_createMockedRequestUserAgent($request);
     $agent->setCookie('a', 'A');
     $agent->fetchResponse(new SimpleUrl('http://this.com/this/path/page.html'), new SimpleGetEncoding());
 }
开发者ID:pvalencia,项目名称:CoordinaChile,代码行数:11,代码来源:user_agent_test.php

示例2: writeCookiesToJar

 /**
  *    Writes new cookies to the cookie jar.
  *    @param SimpleCookieJar $jar   Jar to write to.
  *    @param SimpleUrl $url         Host and path to write under.
  *    @access public
  */
 function writeCookiesToJar(&$jar, $url)
 {
     foreach ($this->_cookies as $cookie) {
         $jar->setCookie($cookie->getName(), $cookie->getValue(), $url->getHost(), $cookie->getPath(), $cookie->getExpiry());
     }
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:12,代码来源:http.php

示例3: testCookieClearByLoweringDate

 function testCookieClearByLoweringDate()
 {
     $jar = new SimpleCookieJar();
     $jar->setCookie('a', 'abc', false, '/', 'Wed, 25-Dec-02 04:24:21 GMT');
     $jar->setCookie('a', 'def', false, '/', 'Wed, 25-Dec-02 04:24:19 GMT');
     $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array('a=def'));
     $jar->restartSession('Wed, 25-Dec-02 04:24:20 GMT');
     $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array());
 }
开发者ID:ahiliation,项目名称:beautifulwork,代码行数:9,代码来源:cookies_test.php

示例4: testMultipleCookieWriting

 function testMultipleCookieWriting()
 {
     $socket =& new MockSimpleSocket();
     $socket->expectArgumentsAt(0, 'write', array("Cookie: a=A;b=B\r\n"));
     $route =& new MockSimpleRoute();
     $route->setReturnReference('createConnection', $socket);
     $jar = new SimpleCookieJar();
     $jar->setCookie('a', 'A');
     $jar->setCookie('b', 'B');
     $request =& new SimpleHttpRequest($route, new SimpleGetEncoding());
     $request->readCookiesFromJar($jar, new SimpleUrl('/'));
     $request->fetch(15);
 }
开发者ID:pvalencia,项目名称:CoordinaChile,代码行数:13,代码来源:http_test.php

示例5: testCookieClearByDate

 function testCookieClearByDate()
 {
     $jar = new SimpleCookieJar();
     $jar->setCookie(new SimpleCookie("a", "abc", "/", "Wed, 25-Dec-02 04:24:21 GMT"));
     $jar->setCookie(new SimpleCookie("a", "def", "/", "Wed, 25-Dec-02 04:24:19 GMT"));
     $cookies = $jar->getValidCookies(false, "/");
     $this->assertIdentical($cookies[0]->getValue(), "def");
     $jar->restartSession("Wed, 25-Dec-02 04:24:20 GMT");
     $this->assertEqual(count($jar->getValidCookies(false, "/")), 0);
 }
开发者ID:justinlyon,项目名称:scc,代码行数:10,代码来源:user_agent_test.php


注:本文中的SimpleCookieJar::setCookie方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。