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


PHP HTTPRequest::getAllHeaders方法代碼示例

本文整理匯總了PHP中HTTPRequest::getAllHeaders方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTTPRequest::getAllHeaders方法的具體用法?PHP HTTPRequest::getAllHeaders怎麽用?PHP HTTPRequest::getAllHeaders使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HTTPRequest的用法示例。


在下文中一共展示了HTTPRequest::getAllHeaders方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: HTTPRequest

 /**
  * Constructor.
  * It builds the HTTPRequest object
  *
  * @todo a URI Helper should be written.
  * @todo a Cookie class should be written.
  */
 public function HTTPRequest()
 {
     $this->method = isset($_SERVER['REQUEST_METHOD']) ? strtoupper($_SERVER['REQUEST_METHOD']) : 'GET';
     foreach (array_merge($_GET, $_POST) as $key => $value) {
         $this->setParameter($key, $value);
     }
     foreach ($_COOKIE as $cookie_name => $cookie_value) {
         $this->cookies[$cookie_name] = new Cookie($cookie_name, $cookie_value);
     }
     unset($_REQUEST);
     unset($_GET);
     unset($_POST);
     if (array_key_exists('PATH_INFO', $_SERVER) && $_SERVER['PATH_INFO'] != '') {
         $this->requestUri = $_SERVER['PATH_INFO'];
     } elseif (array_key_exists('REQUEST_URI', $_SERVER)) {
         $this->requestUri = substr($_SERVER['REQUEST_URI'], 7);
     }
     $this->session = new Session();
     $this->headers = HTTPRequest::getAllHeaders();
 }
開發者ID:BackupTheBerlios,項目名稱:medick-svn,代碼行數:27,代碼來源:HTTPRequest.php

示例2: HTTPRequest

 /**
  * It builds the HTTPRequest object
  */
 public function HTTPRequest()
 {
     $this->method = isset($_SERVER['REQUEST_METHOD']) ? strtoupper($_SERVER['REQUEST_METHOD']) : 'GET';
     foreach (array_merge($_GET, $_POST) as $key => $value) {
         $this->setParameter($key, $value);
     }
     foreach ($_COOKIE as $cookie_name => $cookie_value) {
         $this->cookies[$cookie_name] = new Cookie($cookie_name, $cookie_value);
     }
     unset($_REQUEST);
     unset($_GET);
     unset($_POST);
     // setup requestUri
     if (array_key_exists('PATH_INFO', $_SERVER) && $_SERVER['PATH_INFO'] != '') {
         $this->requestUri = $_SERVER['PATH_INFO'];
     } elseif (array_key_exists('ORIG_PATH_INFO', $_SERVER)) {
         // todo: it should be also tested for non root locations eg:
         // http://www.example.com/foo/medick/myapplication/project/create.html
         // should substract only /project/create.html!
         // even if we don't use rewrite mode (rewrite=off in config file) this should work.
         $this->requestUri = $_SERVER['ORIG_PATH_INFO'];
     } else {
         // fallback to REQUEST_URI
         $this->requestUri = substr($_SERVER['REQUEST_URI'], 7);
     }
     $this->session = new Session();
     $this->headers = HTTPRequest::getAllHeaders();
 }
開發者ID:BackupTheBerlios,項目名稱:medick-svn,代碼行數:31,代碼來源:HTTPRequest.php


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