當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。