當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。