title: PHP Excel Header
body: <pre><code>header("Content-Type:   application/vnd.ms-excel; charset=utf-8");
  header("Content-type:   application/x-msexcel; charset=utf-8");
  header("Content-Disposition: attachment; filename=abc.xsl"); 
  header("Expires: 0");
  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  header("Cache-Control: private",false);
  echo "Some Text"
  </code></pre>
  
  <p>Here is code to write and download xsl file using php,<br>
  my problem is when i open excel file MS-Excel show warning before opening file says  </p>
  
  <blockquote>
    <p>The file you are trying to open is in different format than specified by the file extension...Blah blah</p>
  </blockquote>
  
  <p>What's to do with PHP code to remove this warning? Contents are written correctly. </p>
  
  <p>I know this is because content written in file are txt file content and file extension is incorrect, that is, xls. Solution?</p>
  
  <p>Please don't suggest to use any library.</p>