i have a website with one simple function to generate an excel with array data and then offers user to download.
header( "Content-Type: application/vnd.ms-excel" );
header( "Content-disposition: attachment; filename=spreadsheet.xls" );
echo 'First Name' . "\t" . 'Last Name' . "\t" . 'Phone' . "\n";
echo 'John' . "\t" . 'Doe' . "\t" . '555-5555' . "\n";
the code above was used to test, but I only get some html code from the website in the excel, not the data.
May I ask why it happens? Thanks!