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


PHP Response::factory方法代码示例

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


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

示例1: execute

 public function execute(Request $request)
 {
     if ($this->callback_depth() > $this->max_callback_depth()) {
         throw new Request_Client_Recursion_Exception("Could not execute request to :uri - too many recursions after :depth requests", array(":uri" => $request->uri(), ":depth" => $this->callback_depth() - 1));
     }
     $orig_response = $response = Response::factory(array("_protocol" => $request->protocol()));
     if (($cache = $this->cache()) instanceof HTTP_Cache) {
         return $cache->execute($this, $request, $response);
     }
     $response = $this->execute_request($request, $response);
     foreach ($this->header_callbacks() as $header => $callback) {
         if ($response->headers($header)) {
             $cb_result = call_user_func($callback, $request, $response, $this);
             if ($cb_result instanceof Request) {
                 $this->assign_client_properties($cb_result->client());
                 $cb_result->client()->callback_depth($this->callback_depth() + 1);
                 $response = $cb_result->execute();
             } elseif ($cb_result instanceof Response) {
                 $response = $cb_result;
             }
             if ($response !== $orig_response) {
                 break;
             }
         }
     }
     return $response;
 }
开发者ID:benshez,项目名称:DreamWeddingCeremomies,代码行数:27,代码来源:Client.php

示例2: get_response

 public function get_response()
 {
     $view = View::factory('error/500');
     $view->message = $this->getMessage();
     $response = Response::factory()->status(500)->body($view->render());
     return $response;
 }
开发者ID:Jurasikt,项目名称:kohana,代码行数:7,代码来源:500.php

示例3: get_response

 public function get_response()
 {
     $twig = Twig::factory('frontend/main');
     $response = $twig->render('Public/404');
     $response = Response::factory()->status(404)->body($response);
     return $response;
 }
开发者ID:robert-kampas,项目名称:games-collection-manager,代码行数:7,代码来源:404.php

示例4: response

 /**
  * Attempt to query error/500 manually, as we cannot catch exceptions through traditional HMVC requests.
  * Catch potential exceptions such as database is down and display a lightweight error message.
  *
  * @param Exception $e
  * @return Response
  */
 public static function response(Exception $e)
 {
     if (Kohana::$environment >= Kohana::DEVELOPMENT) {
         return parent::response($e);
     }
     try {
         // Create the request, we need to set controller and action manual as they
         // otherwise gets set in execute method.
         $request = Request::factory();
         $request->controller(Kohana_Exception::$_controller);
         $request->action(Kohana_Exception::$_method);
         // Setup the response object
         $response = Response::factory();
         $response->status(500);
         $response->headers('Content-Type', Kohana_Exception::$error_view_content_type . '; charset=' . Kohana::$charset);
         // Call the controller.
         $controller = new Controller_Error($request, $response);
         return $controller->execute();
     } catch (Exception $e) {
         // Render the fallback view.
         $view = View::factory('errors/fallback');
         $response = Response::factory();
         $response->status(500);
         $response->body($view->render());
         return $response;
     }
 }
开发者ID:modulargaming,项目名称:modulargaming,代码行数:34,代码来源:Exception.php

示例5: get_response

 public function get_response()
 {
     $response = Response::factory();
     $view = View::factory('errors/403');
     $response->body($view->render());
     return $response;
 }
开发者ID:paShaman,项目名称:Scala,代码行数:7,代码来源:403.php

示例6: get_response

 public function get_response()
 {
     // HTTP/404.php - это файл шаблона, можно указать другой файл
     $view = View::factory('HTTP/404');
     $view->message = $this->getMessage();
     $response = Response::factory()->status(404)->body($view->render());
     return $response;
 }
开发者ID:piotrazsko,项目名称:accounting,代码行数:8,代码来源:404.php

示例7: get_response

 /**
  * Generate a Response for the 404 Exception.
  *
  * The user should be shown a nice 404 page.
  * 
  * @return Response
  */
 public function get_response()
 {
     $view = View::factory('errors/404');
     // Remembering that `$this` is an instance of HTTP_Exception_404
     $view->message = $this->getMessage();
     $response = Response::factory()->status(404)->body($view->render());
     return $response;
 }
开发者ID:sanin25,项目名称:myGoOn,代码行数:15,代码来源:my.php

示例8: get_response

 public function get_response()
 {
     $view = new View_Error_404();
     $renderer = Kostache_Layout::factory('404');
     $response = Response::factory()->status(404);
     $response->body($renderer->render($view));
     return $response;
 }
开发者ID:moult,项目名称:ko-errorpage,代码行数:8,代码来源:404.php

示例9: get_response

 /**
  * Generate a Response for the 401 Exception.
  *
  * Unauthorized / Login Requied
  * The user should be redirect to a login page.
  *
  * @return Response
  */
 public function get_response()
 {
     // Todo:: これはどうつくるの?
     // Get tpl directory
     $home_page = Cms_Helper::settings('home_page');
     $response = Response::factory()->status(401)->headers('Location', URL::site($home_page, 'http'));
     return $response;
 }
开发者ID:deraemons,项目名称:deraemon-cms,代码行数:16,代码来源:401.php

示例10: get_response

 public function get_response()
 {
     $response = Response::factory();
     $view = Kotwig_View::factory('errors/500');
     $response->status(500);
     $response->body($view->render());
     return $response;
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:8,代码来源:500.php

示例11: __construct

 public function __construct()
 {
     $this->request = Request::current();
     if ($this->request->controller() == "Clients" && $this->request->action() == "detail") {
         $this->current_client = new Model_Client($this->request->param('id'));
         return $this->current_client;
     }
     parent::__construct(Request::current(), Response::factory());
 }
开发者ID:Workhaven,项目名称:workhaven,代码行数:9,代码来源:Menu.php

示例12: get_response

 public function get_response()
 {
     $response = Response::factory();
     $view = View::factory('errors/404');
     // We're inside an instance of Exception here, all the normal stuff is available.
     $view->message = $this->getMessage();
     $response->body($view->render());
     return $response;
 }
开发者ID:paShaman,项目名称:Scala,代码行数:9,代码来源:404.php

示例13: get_response

 /**
  * Generate a Response for the 404 Exception.
  *
  * The user should be shown a nice 404 page.
  * 
  * @return Response
  */
 public function get_response()
 {
     //return;
     $view = View::factory('404view');
     // Remembering that `$this` is an instance of HTTP_Exception_404
     // $view->message = $this->getMessage();
     $view->message = "Страница не найдена";
     $response = Response::factory()->status(404)->body($view->render());
     return $response;
 }
开发者ID:alex-bro,项目名称:olgabro.repo,代码行数:17,代码来源:404.php

示例14: get_response

 /**
  * Generates a Response for all Exceptions without a specific override
  *
  * @return Response
  */
 public function get_response()
 {
     // Log the exception
     Kohana_Exception::log($this);
     $response = Response::factory();
     $view = Swiftriver::get_base_error_view();
     $view->content = View::factory('pages/errors/404')->set('page', $this->request()->uri());
     $response->body($view->render());
     return $response;
 }
开发者ID:aliyubash23,项目名称:SwiftRiver,代码行数:15,代码来源:404.php

示例15: send

 /**
  * @return Response
  */
 public function send()
 {
     $this->_setProperAccountancyMonth();
     $content = $this->_invoice->toJson();
     $this->_initCurrentCurl(self::API_INVOICE_URL);
     $key = Utils::hexToStr($this->_getConfig()->{Config::API_KEY_INVOICE});
     $messageHash = Utils::hmac($key, sprintf("%s%s%s%s", self::API_INVOICE_URL, $this->_getConfig()->{Config::API_LOGIN}, Config::API_KEY_INVOICE_NAME, $content));
     $this->_setCurlPostOptions(self::API_INVOICE_URL, $this->_getRequestHeaders($messageHash), $content);
     return Response::factory(curl_exec($this->_currentCurl));
 }
开发者ID:s-neilo,项目名称:ifirma-api-sklepy,代码行数:13,代码来源:ConnectorInvoice.php


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