PHP Класс Symfony\Component\HttpFoundation\BinaryFileResponse

Автор: Niklas Fiekas ([email protected])
Автор: stealth35 ([email protected])
Автор: Igor Wiedler ([email protected])
Автор: Jordan Alliot ([email protected])
Автор: Sergey Linnik ([email protected])
Наследование: extends Response
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$deleteFileAfterSend
$file Symfony\Component\HttpFoundation\File\File
$maxlen
$offset
$trustXSendfileTypeHeader

Открытые методы

Метод Описание
__construct ( SplFileInfo | string $file, integer $status = 200, array $headers = [], boolean $public = true, null | string $contentDisposition = null, boolean $autoEtag = false, boolean $autoLastModified = true ) Constructor.
create ( SplFileInfo | string $file = null, integer $status = 200, array $headers = [], boolean $public = true, null | string $contentDisposition = null, boolean $autoEtag = false, boolean $autoLastModified = true ) : BinaryFileResponse
deleteFileAfterSend ( boolean $shouldDelete ) : BinaryFileResponse If this is set to true, the file will be unlinked after the request is send Note: If the X-Sendfile header is used, the deleteFileAfterSend setting will not be used.
getContent ( ) : false
getFile ( ) : File Gets the file.
prepare ( Request $request )
sendContent ( ) Sends the file.
setAutoEtag ( ) Automatically sets the ETag header according to the checksum of the file.
setAutoLastModified ( ) Automatically sets the Last-Modified header according the file modification date.
setContent ( $content )
setContentDisposition ( string $disposition, string $filename = '', string $filenameFallback = '' ) : BinaryFileResponse Sets the Content-Disposition header with the given filename.
setFile ( SplFileInfo | string $file, string $contentDisposition = null, boolean $autoEtag = false, boolean $autoLastModified = true ) : BinaryFileResponse Sets the file to stream.
trustXSendfileTypeHeader ( ) Trust X-Sendfile-Type header.

Приватные методы

Метод Описание
hasValidIfRangeHeader ( $header )

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( SplFileInfo | string $file, integer $status = 200, array $headers = [], boolean $public = true, null | string $contentDisposition = null, boolean $autoEtag = false, boolean $autoLastModified = true )
$file SplFileInfo | string The file to stream
$status integer The response status code
$headers array An array of response headers
$public boolean Files are public by default
$contentDisposition null | string The type of Content-Disposition to set automatically with the filename
$autoEtag boolean Whether the ETag header should be automatically set
$autoLastModified boolean Whether the Last-Modified header should be automatically set

create() публичный статический Метод

public static create ( SplFileInfo | string $file = null, integer $status = 200, array $headers = [], boolean $public = true, null | string $contentDisposition = null, boolean $autoEtag = false, boolean $autoLastModified = true ) : BinaryFileResponse
$file SplFileInfo | string The file to stream
$status integer The response status code
$headers array An array of response headers
$public boolean Files are public by default
$contentDisposition null | string The type of Content-Disposition to set automatically with the filename
$autoEtag boolean Whether the ETag header should be automatically set
$autoLastModified boolean Whether the Last-Modified header should be automatically set
Результат BinaryFileResponse The created response

deleteFileAfterSend() публичный Метод

If this is set to true, the file will be unlinked after the request is send Note: If the X-Sendfile header is used, the deleteFileAfterSend setting will not be used.
public deleteFileAfterSend ( boolean $shouldDelete ) : BinaryFileResponse
$shouldDelete boolean
Результат BinaryFileResponse

getContent() публичный Метод

public getContent ( ) : false
Результат false

getFile() публичный Метод

Gets the file.
public getFile ( ) : File
Результат Symfony\Component\HttpFoundation\File\File The file to stream

prepare() публичный Метод

public prepare ( Request $request )
$request Request

sendContent() публичный Метод

public sendContent ( )

setAutoEtag() публичный Метод

Automatically sets the ETag header according to the checksum of the file.
public setAutoEtag ( )

setAutoLastModified() публичный Метод

Automatically sets the Last-Modified header according the file modification date.
public setAutoLastModified ( )

setContent() публичный Метод

public setContent ( $content )

setContentDisposition() публичный Метод

Sets the Content-Disposition header with the given filename.
public setContentDisposition ( string $disposition, string $filename = '', string $filenameFallback = '' ) : BinaryFileResponse
$disposition string ResponseHeaderBag::DISPOSITION_INLINE or ResponseHeaderBag::DISPOSITION_ATTACHMENT
$filename string Optionally use this filename instead of the real name of the file
$filenameFallback string A fallback filename, containing only ASCII characters. Defaults to an automatically encoded filename
Результат BinaryFileResponse

setFile() публичный Метод

Sets the file to stream.
public setFile ( SplFileInfo | string $file, string $contentDisposition = null, boolean $autoEtag = false, boolean $autoLastModified = true ) : BinaryFileResponse
$file SplFileInfo | string The file to stream
$contentDisposition string
$autoEtag boolean
$autoLastModified boolean
Результат BinaryFileResponse

trustXSendfileTypeHeader() публичный статический Метод

Trust X-Sendfile-Type header.
public static trustXSendfileTypeHeader ( )

Описание свойств

$deleteFileAfterSend защищенное свойство

protected $deleteFileAfterSend

$file защищенное свойство

protected File,Symfony\Component\HttpFoundation\File $file
Результат Symfony\Component\HttpFoundation\File\File

$maxlen защищенное свойство

protected $maxlen

$offset защищенное свойство

protected $offset

$trustXSendfileTypeHeader защищенное статическое свойство

protected static $trustXSendfileTypeHeader