0

嗨,我正在创建和下载 Excel 表。它创建和下载 Excel 表。我的问题是在下载显示以下消息的 excel 表时。

 The file format and extension of 'filename.xls' don't match. The file culd be corrupted 
 or unsafe.Unless you trust it source,don't open it Do you want to open it any way ?

当我点击确定时我得到了这个消息,它显示了 excel。我需要处理这个消息当我在谷歌搜索时,我找到了注册表详细信息和文件的唯一编号(
这个数字的我们是什么?)但我没有得到那个你能给我源链接吗

请帮助我如何处理它。

嗨,我正在使用 cakePHP 框架,我使用以下代码生成 excel

        $rpt['Attachment']['file_type'] = 'application/vnd.ms-excel';

        $rpt['Attachment']['file_name'] = 'LeavesReport_'.$frmDate.'-'.$toDate.'.xls';          
        $fileName = 'LeavesReport_'.$frmDate.'-'.$toDate.'.xls';


        $rpt['Attachment']['file_name'] = str_replace(' ','_',$fileName);
        $this->set('attachment', $rpt);
        $this->set('rptData', array_values($absRecords));
        $this->render('reports_download', 'file');

我使用了文件布局文件布局的详细信息如下:

header('Content-type: ' . $attachment['Attachment']['file_type']);
header('Content-Disposition: attachment; filename="'.$attachment['Attachment'] 
['file_name'].'"');
echo $content_for_layout;
4

0 回答 0