私はこのコードを持っていますが、ローカルでは動作しますが、ライブではありません-これはデータベースのクエリから結果を受け取ります現在、出力はブラウザにのみ送信されます-ローカルのようにダウンロードは提供されません:
if($_POST['xls'] == 'on'){
$file_type = "vnd.ms-excel";
$file_ending = "xls";
$ttype = date('m-d-Y-H:i:s');
header("Content-Type: application/$file_type");
//header("Content-Type: application/force-download");
//header("Content-Type: application/octet-stream");
//header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=$ttype.$file_ending");
header("Pragma: no-cache");
header("Expires: 0");
}
両方のサーバーは Linux で、ライブ サーバーは php 5.2.17 で cPanel を実行しています 私は cpanel サーバーを管理しておらず、php をアップグレードできません
ありがとう