0

プログラムの出力をphpで「リアルタイム」に出力したいと思います(バッファは重要ではありません)。このプロセスには時間がかかるため、(部分的な)データを事前に入手しておくと非常に役立ちます。

通常は単純な passthru() を使用しますが、これは CakePHP で行われ、これを行うまで何も出力しません:

$this->response->file($file, array('download' => true));
return $this->response;

これらの行を削除して exec() を passthru() に交換すると、 MissingViewException が発生します

Error: [MissingViewException] View file "Songs/download.ctp" is missing.

そしてもし私がこれをしたら

$this->response=$out; #$out being the output of exec()
return $this->response;

私はこれを得る

2015-08-10 01:18:06 Error: Fatal Error (1): Call to a member function body() on string in [/storage/www/sonerezh/lib/Cake/Controller/Controller.php, line 960]
2015-08-10 01:18:06 Error: [InternalErrorException] Internal Server Error
Request URL: /songs/download/2307
Stack Trace:
#0 /storage/www/sonerezh/lib/Cake/Error/ErrorHandler.php(213): ErrorHandler::handleFatalError(1, 'Call to a membe...', '/storage/www/so...', 960)
#1 [internal function]: ErrorHandler::handleError(1, 'Call to a membe...', '/storage/www/so...', 960, Array)
#2 /storage/www/sonerezh/lib/Cake/Core/App.php(931): call_user_func('ErrorHandler::h...', 1, 'Call to a membe...', '/storage/www/so...', 960, Array)
#3 /storage/www/sonerezh/lib/Cake/Core/App.php(904): App::_checkFatalError()
#4 [internal function]: App::shutdown()
#5 {main}

私に何ができる?

4

1 に答える 1