当前位置: 首页>>代码示例>>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;未经允许,请勿转载。