コード例 #1
0
 /**
  * Redirect response
  *
  * @param  string $url
  * @param  string $code
  * @param  string $version
  * @return void
  */
 public function redirect($url, $code = '302', $version = '1.1')
 {
     $this->application->trigger('app.send.pre', ['controller' => $this]);
     $this->application->trigger('app.send.post', ['controller' => $this]);
     Response::redirect($url, $code, $version);
     exit;
 }
コード例 #2
0
 /**
  * Send response
  *
  * @param  int    $code
  * @param  array  $headers
  * @param  string $body
  * @return void
  */
 public function send($code = 200, array $headers = null, $body = null)
 {
     $this->response->setCode($code);
     $this->application->trigger('app.send.pre', ['controller' => $this]);
     if (null !== $body) {
         $this->response->setBody($body);
     } else {
         if (null !== $this->view) {
             $this->response->setBody($this->view->render());
         }
     }
     $this->application->trigger('app.send.post', ['controller' => $this]);
     $this->response->send($code, $headers);
 }