|
|
@ -138,9 +138,12 @@ class Response extends \yii\base\Response |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public $content; |
|
|
|
public $content; |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @var resource|array the stream to be sent. This can be a stream handle or an array of stream handle, |
|
|
|
* @var resource|array|callable the stream to be sent. This can be a stream handle or an array of stream handle, |
|
|
|
* the begin position and the end position. Note that when this property is set, the [[data]] and [[content]] |
|
|
|
* the begin position and the end position. Alternatively it can be set to a callable, which returns |
|
|
|
* properties will be ignored by [[send()]]. |
|
|
|
* (or [yields](https://www.php.net/manual/en/language.generators.syntax.php)) an array of strings that should |
|
|
|
|
|
|
|
* be echoed and flushed out one by one. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* Note that when this property is set, the [[data]] and [[content]] properties will be ignored by [[send()]]. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public $stream; |
|
|
|
public $stream; |
|
|
|
/** |
|
|
|
/** |
|
|
@ -441,6 +444,15 @@ class Response extends \yii\base\Response |
|
|
|
Yii::warning('set_time_limit() is not available', __METHOD__); |
|
|
|
Yii::warning('set_time_limit() is not available', __METHOD__); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (is_callable($this->stream)) { |
|
|
|
|
|
|
|
$data = call_user_func($this->stream); |
|
|
|
|
|
|
|
foreach ($data as $datum) { |
|
|
|
|
|
|
|
echo $datum; |
|
|
|
|
|
|
|
flush(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$chunkSize = 8 * 1024 * 1024; // 8MB per chunk |
|
|
|
$chunkSize = 8 * 1024 * 1024; // 8MB per chunk |
|
|
|
|
|
|
|
|
|
|
|
if (is_array($this->stream)) { |
|
|
|
if (is_array($this->stream)) { |
|
|
|