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


PHP Q_Response::isBuffered方法代码示例

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


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

示例1: dispatch


//.........这里部分代码省略.........
                 if (!in_array($method, $methods)) {
                     throw new Q_Exception_MethodNotSupported(compact('method'));
                 }
                 $method_event = 'Q/' . strtolower($method);
                 if (!isset(self::$skip['Q/method']) and !isset(self::$skip[$method_event])) {
                     if (!Q::canHandle($method_event)) {
                         throw new Q_Exception_MethodNotSupported(compact('method'));
                     }
                     Q::event($method_event);
                 }
             }
             // You can calculate some analytics here, and store them somewhere
             if (!isset(self::$skip['Q/analytics'])) {
                 /**
                  * @event Q/analytics
                  * @param {array} $routed_uri_array
                  */
                 Q::event('Q/analytics', $routed_uri_array, true);
             }
             if (!isset(self::$skip['Q/errors'])) {
                 // Check if any errors accumulated
                 if (Q_Response::getErrors()) {
                     // There were processing errors -- render a response
                     self::result('Processing errors');
                     self::errors(null, $module, null);
                     return false;
                 }
             }
             // When handling all further events, you should probably
             // refrain from changing server state, and only do reading.
             // That is because GET in HTTP is not supposed to have side effects
             // for which the client is responsible.
             // Start buffering the response, unless otherwise requested
             $handler = Q_Response::isBuffered();
             if ($handler !== false) {
                 $ob = new Q_OutputBuffer($handler);
             }
             // Generate and render a response
             /**
              * @event Q/response
              * @param {array} $routed_uri_array
              */
             self::$response_started = true;
             Q::event("Q/response", $routed_uri_array);
             if (!empty($ob)) {
                 $ob->endFlush();
             }
             self::result("Served response");
             return true;
         } catch (Q_Exception_DispatcherForward $e) {
             if (!empty($ob)) {
                 $ob->getClean();
             }
             self::handleForwardException($e);
         } catch (Q_Exception_DispatcherErrors $e) {
             if (!empty($ob)) {
                 $partial_response = $ob->getClean();
             } else {
                 $partial_response = null;
             }
             self::errors(null, $module, $partial_response);
             self::result("Rendered errors");
             return true;
         } catch (Exception $exception) {
             if (!empty($ob)) {
                 $partial_response = $ob->getClean();
开发者ID:dmitriz,项目名称:Platform,代码行数:67,代码来源:Dispatcher.php

示例2: isBuffered

 /**
  * Gets or sets whether the response is buffered.
  * @method isBuffered
  * @static
  * @param {boolean} [$new_value=null] If not present, just returns the current value of this setting.
  *  If true or false, sets the setting to this value, and returns the setting's old value.
  * @return {boolean}
  */
 static function isBuffered($new_value = null)
 {
     $old_value = self::$isBuffered;
     if (isset($new_value)) {
         self::$isBuffered = $new_value;
     }
     return $old_value;
 }
开发者ID:dmitriz,项目名称:Platform,代码行数:16,代码来源:Response.php

示例3: setResponseBuffered

 /**
  * Sets whether the response is buffered from the config, if any
  * @method setResponseBuffered
  * @static
  */
 static function setResponseBuffered()
 {
     $handler = Q_Config::get('Q', 'response', 'isBuffered', null);
     if (isset($handler)) {
         Q_Response::isBuffered($handler);
     }
 }
开发者ID:atirjavid,项目名称:Platform,代码行数:12,代码来源:Bootstrap.php

示例4: response

 /**
  * Returns a response to the client.
  * @param {boolean} [$closeConnection=false] Whether to send headers to close the connection
  * @method response
  * @static
  */
 static function response($closeConnection = false)
 {
     if (self::$servedResponse) {
         return;
         // response was served, and no new dispatch started
     }
     // Start buffering the response, unless otherwise requested
     $handler = Q_Response::isBuffered();
     if ($handler !== false) {
         $ob = new Q_OutputBuffer($handler);
     }
     if (!empty($_GET['Q_ct'])) {
         Q_Response::setCookie('Q_ct', $_GET['Q_ct']);
     }
     if (!empty($_GET['Q_cordova'])) {
         Q_Response::setCookie('Q_cordova', $_GET['Q_cordova']);
     }
     Q_Response::sendCookieHeaders();
     // Generate and render a response
     /**
      * Gives the app a chance to generate a response.
      * You should not change the server state when handling this event.
      * @event Q/response
      * @param {array} $routed
      */
     self::$startedResponse = true;
     Q::event("Q/response", self::$routed);
     if ($closeConnection) {
         header("Connection: close");
         header("Content-Length: " . $ob->getLength());
     }
     if (!empty($ob)) {
         $ob->endFlush();
     }
     if ($closeConnection) {
         ob_end_flush();
         flush();
     }
     self::$servedResponse = true;
     self::result("Served response");
     return true;
 }
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:48,代码来源:Dispatcher.php


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