To generate the code for Word:
Copy CodeThe code is as follows:
Header ("Content-type:application/octet-stream");
Header ("Accept-ranges:bytes");
Header (' Content-type:application/doc ');
Header (' content-disposition:attachment; filename= ' Test. doc "');
to generate the code for Excel:
Copy CodeThe code is as follows:
Header ("Content-type:application/octet-stream");
Header ("Accept-ranges:bytes");
Header ("Content-type:application/vnd.ms-excel");
Header ("content-disposition:attachment;filename=" test. xls ");
But the process will also encounter a lot of problems, such as export Excel, a column to export the identity card number, open Excel file will find that the ID number automatically adopted scientific counting method, regardless of modifying the column properties, can not achieve their own requirements. Some people on the internet said that the first to change the column properties to text, and then input there is no problem, the actual operation of Excel is true, but the PHP program can not be exported. Some people say, in front of the ID number of the single quotation mark, tried also not, finally in the export of the ID card data with a space problem resolution, space is the HTML code space. Problem solving.
http://www.bkjia.com/PHPjc/736781.html www.bkjia.com true http://www.bkjia.com/PHPjc/736781.html techarticle Generate Word Code: Copy Code as follows: Header ("Content-type:application/octet-stream"), Header ("Accept-ranges:bytes"), Header (' Content-type:application/doc '); Header ( .....