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


PHP RequestInterface::getCookie方法代码示例

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


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

示例1: onOpen

 public function onOpen(ConnectionInterface $from, RequestInterface $request = null)
 {
     if (empty($request)) {
         $resp = new Response(400);
         $from->send((string) $resp);
         $from->close();
         return;
     }
     // Session management
     $saveHandler = $this->_handler;
     $id = $request->getCookie(ini_get('session.name'));
     if (empty($id)) {
         $id = sha1(uniqid() . mt_rand());
     }
     // Crappy workaround for sessions - don't know why they are not saved
     // @see https://github.com/ratchetphp/Ratchet/blob/master/src/Ratchet/Session/SessionProvider.php
     if (isset($this->sessions[$id])) {
         $from->Session = $this->sessions[$id];
     } else {
         $from->Session = new Session(new VirtualSessionStorage($saveHandler, $id, $this->_serializer));
         $this->sessions[$id] = $from->Session;
     }
     if (ini_get('session.auto_start')) {
         $from->Session->start();
     }
     $this->onRequest($from, $request);
 }
开发者ID:Rudi9719,项目名称:stein-syn,代码行数:27,代码来源:HttpServer.class.php

示例2: onOpen

 /**
  * {@inheritdoc}
  */
 public function onOpen(ConnectionInterface $conn, RequestInterface $request = null)
 {
     if (null === $request || null === ($id = $request->getCookie(ini_get('session.name')))) {
         $saveHandler = $this->_null;
         $id = '';
     } else {
         $saveHandler = $this->_handler;
     }
     $conn->Session = new Session(new VirtualSessionStorage($saveHandler, $id, $this->_serializer));
     if (ini_get('session.auto_start')) {
         $conn->Session->start();
     }
     return $this->_app->onOpen($conn, $request);
 }
开发者ID:pantnik,项目名称:DIYiotServer,代码行数:17,代码来源:SessionProvider.php

示例3: onRequest

 protected function onRequest(GuzzleRequest $request)
 {
     if (null === ($id = $request->getCookie(ini_get('session.name')))) {
         $saveHandler = new NullSessionHandler();
         $id = '';
     } else {
         $saveHandler = $this->saveHandler;
     }
     $serialClass = "Ratchet\\Session\\Serialize\\{$this->toClassCase(ini_get('session.serialize_handler'))}Handler";
     // awesome/terrible hack, eh?
     if (!class_exists($serialClass)) {
         throw new \RuntimeException('Unable to parse session serialize handler');
     }
     $serializer = new $serialClass();
     $this->session = new Session(new VirtualSessionStorage($saveHandler, $id, $serializer));
     if (ini_get('session.auto_start')) {
         $this->session->start();
     }
 }
开发者ID:elfchat,项目名称:elfchat,代码行数:19,代码来源:Action.php

示例4: getCookie

 /**
  * Get a cookie value by name
  *
  * @param string $name Cookie to retrieve
  *
  * @return null|string
  */
 public function getCookie($name)
 {
     return $this->wrapped->getCookie($name);
 }
开发者ID:cosmorogers,项目名称:http-mock,代码行数:11,代码来源:UnifiedRequest.php


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