/** * Creates a response that prompts the user to download a file which * contains the passed string * Additionally the response will be cacheable by browsers. Since the content is * generally not sensitive content (e.g. Logos in mails) this should not be a problem. * @param string $content the content that should be written into the file * @param string $filename the name that the downloaded file should have * @param string $contentType the mimetype that the downloaded file should have */ public function __construct($content, $filename, $contentType) { parent::__construct($filename, $contentType); $this->content = $content; $expires = new \DateTime('now + 11 months'); $this->addHeader('Expires', $expires->format(\DateTime::RFC1123)); $this->addHeader('Cache-Control', 'private'); $this->addHeader('Pragma', 'cache'); }
/** * Creates a response that prompts the user to download a file which * contains the passed string * @param string $content the content that should be written into the file * @param string $filename the name that the downloaded file should have * @param string $contentType the mimetype that the downloaded file should have */ public function __construct($content, $filename, $contentType) { parent::__construct($filename, $contentType); $this->content = $content; }