0

Zend Framework 1 を使用してファイルをダウンロードしたいと考えています。ファイルは現在ローカル ディスクにあります。

私の downloadAction は次のようになります。

public function downloadAction() {
    header('Content-Type: some/contentType');
    header('Content-Disposition: attachment; filename="myFile.ext"');
    readfile('path/to/myFile.ext');

    // disable layout and view
    $this->view->layout()->disableLayout();
    $this->_helper->viewRenderer->setNoRender(true);
}

( http://www.stoimen.com/blog/2010/05/25/download-files-with-zend-framework/も参照)

magic_mime モジュールまたは fileinfo モジュールをインストールせずに、ファイルの自動 MIME 検出を追加することは可能ですか?

4

1 に答える 1

0

あなたの質問に対する短い答えは「いいえ」ですが、バージョン 5.3.0 の時点で fileinfo 拡張機能が PHP にバンドルされています。それより古いバージョンを使用している場合は、より大きな問題が発生します。

于 2013-09-12T13:04:41.063 に答える