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


PHP KRequest::protocol方法代碼示例

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


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

示例1: __construct

 /**
  * Constructor
  *
  * @param   object  An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     if (strpos(KRequest::protocol(), 'http') !== false) {
         $this->registerCallback('before.read', array($this, 'setReferrer'));
         $this->registerCallback('after.save', array($this, 'unsetReferrer'));
         $this->registerCallback('after.cancel', array($this, 'unsetReferrer'));
     }
     $this->registerCallback('after.read', array($this, 'lockResource'));
     $this->registerCallback('after.save', array($this, 'unlockResource'));
     $this->registerCallback('after.cancel', array($this, 'unlockResource'));
     //Set the default redirect.
     $this->setRedirect(KRequest::referrer());
 }
開發者ID:raeldc,項目名稱:nooku-server,代碼行數:19,代碼來源:editable.php

示例2: set

 /**
  * Set a variable in the request. Cookies and session data are stored persistently.
  *
  * @param   mixed   Variable identifier, prefixed by hash name eg post.foo.bar
  * @param   mixed   Variable value
  */
 public static function set($identifier, $value)
 {
     list($hash, $keys) = self::_parseIdentifier($identifier);
     // Add to _REQUEST hash if original hash is get, post, or cookies
     if (in_array($hash, array('GET', 'POST', 'COOKIE'))) {
         self::set('request.' . implode('.', $keys), $value);
     }
     // Store cookies persistently
     if ($hash == 'COOKIE' && strpos(KRequest::protocol(), 'http') !== false) {
         // rewrite the $keys as foo[bar][bar]
         $ckeys = $keys;
         // get a copy
         $name = array_shift($ckeys);
         foreach ($ckeys as $ckey) {
             $name .= '[' . $ckey . ']';
         }
         if (!setcookie($name, $value)) {
             throw new KRequestException("Couldn't set cookie, headers already sent.");
         }
     }
     // Store in $GLOBALS
     foreach (array_reverse($keys, true) as $key) {
         $value = array($key => $value);
     }
     // Add the global if it's doesn't exist
     if (!isset($GLOBALS['_' . $hash])) {
         $GLOBALS['_' . $hash] = array();
     }
     $GLOBALS['_' . $hash] = KHelperArray::merge($GLOBALS['_' . $hash], $value);
 }
開發者ID:janssit,項目名稱:www.marlinfishingcanaria.com,代碼行數:36,代碼來源:request.php

示例3: _actionRender

 /**
  * Push the controller data into the document
  *
  * This function divert the standard behavior and will push specific controller data
  * into the document
  *
  * @return	mixed
  */
 protected function _actionRender(KCommandContext $context)
 {
     //Headers
     if ($context->headers) {
         foreach ($context->headers as $name => $value) {
             header($name . ' : ' . $value);
         }
     }
     //Status
     if ($context->status) {
         header(KHttpResponse::getHeader($context->status, KRequest::protocol()));
     }
     if (is_string($context->result)) {
         return $context->result;
     }
 }
開發者ID:stonyyi,項目名稱:anahita,代碼行數:24,代碼來源:abstract.php


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