예제 #1
0
파일: Download.php 프로젝트: colorium/http
 /**
  * New Redirect Response
  *
  * @param string $filename
  * @param int $code
  * @param array $headers
  */
 public function __construct($filename, $code = 302, array $headers = [])
 {
     parent::__construct(null, $code, $headers);
     $this->filename = $filename;
     $this->header('Content-Type', 'application/octet-stream');
     $this->header('Content-Length', filesize($filename));
     $this->header('Content-Disposition', 'attachment; filename=\\"' . basename($filename) . '\\"');
     $this->noCache();
 }
예제 #2
0
파일: Json.php 프로젝트: colorium/http
 /**
  * New JSON Response
  *
  * @param string $content
  * @param int $code
  * @param array $headers
  */
 public function __construct($content = null, $code = 200, array $headers = [])
 {
     $content = json_encode($content, JSON_PRETTY_PRINT);
     parent::__construct($content, $code, $headers);
 }
예제 #3
0
파일: Redirect.php 프로젝트: colorium/http
 /**
  * New Redirect Response
  *
  * @param string $uri
  * @param int $code
  * @param array $headers
  */
 public function __construct($uri, $code = 302, array $headers = [])
 {
     parent::__construct(null, $code, $headers);
     $this->uri = (string) $uri;
 }
예제 #4
0
파일: Template.php 프로젝트: colorium/http
 /**
  * New Template Response
  *
  * @param string $template
  * @param array $vars
  * @param int $code
  * @param array $headers
  */
 public function __construct($template, array $vars = [], $code = 200, array $headers = [])
 {
     parent::__construct(null, $code, $headers);
     $this->template = $template;
     $this->vars = $vars;
 }