改名
This commit is contained in:
@@ -7,6 +7,7 @@ use JetBrains\PhpStorm\Pure;
|
||||
use Kiri\Core\Help;
|
||||
use Kiri\ToArray;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Server\SInterface\DownloadInterface;
|
||||
|
||||
|
||||
/**
|
||||
@@ -174,6 +175,24 @@ class Response implements ResponseInterface, \Server\ResponseInterface
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $path
|
||||
* @param bool $isChunk
|
||||
* @param int $size
|
||||
* @param int $offset
|
||||
* @return DownloadInterface
|
||||
* @throws Exception
|
||||
*/
|
||||
public function file($path, bool $isChunk = false, int $size = -1, int $offset = 0): DownloadInterface
|
||||
{
|
||||
$path = realpath($path);
|
||||
if (!file_exists($path) || !is_readable($path)) {
|
||||
throw new Exception('Cannot read file "' . $path . '", no permission');
|
||||
}
|
||||
return (new Download())->path($path, $isChunk, $size, $offset);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $responseData
|
||||
* @return string|array|bool|int|null
|
||||
|
||||
Reference in New Issue
Block a user