php Solutions and considerations that cannot be opened after you download Excel, please refer to use
PHP download Excel file, 1, in the process of downloading do not output any non-file information, such as Echo log information. Otherwise, the downloaded file cannot be opened, prompting for formatting errors or corrupted files. 2, the output of Excel format must and suffix name to save all the time, no will also prompt format error or file corrupted code as follows: if (File_exists (Cache_path. $file _name)) { &N Bsp //$this->logger->error (' File Realpath: '. Realpath (Cache_path. $file _name)); Header (' pragma:public '); Header (' expires:0 '); Header (' Content-encoding:none '); Header (' Cache-control:must-revalidate, post-check=0, pre-check=0 '); Header (' cache-control:public '); header (' content-type:application/vnd.ms-excel '); header (' Content-description:file Transfer '); Header (' Content-disposition:attachment filename= '. $file _name); Header (' content-transfer-encoding:binary '); Header (' Content-length: FileSize (cache_path. $file _name)); &NBSP ReadFile (cache_path. $file _name); } else { $this->logger->error (' Export model: '. $id. ' ERROR: No production file '); echo ' < Script>alert (' Export error, File not exists! ') </script> '; }