使用PHP导出到Excel

时间:2019-06-20 16:00:12

标签: php excel codeigniter

我正在Codeigniter中加载要导出到Excel的视图。 但是在加载表之后,我正在运行一个JS函数,该函数会更新每行的最后一列。

问题是最后一栏没有更新,我只能用JavaScript做到。

控制器:

$msg = $this->load->view("some_view", $data, TRUE); //$data contains the data I want to display in the table

$file_name = "Some_File_Name.xls";

header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header("Content-Type: application/force-download");
header('Content-Disposition: attachment; filename=' . $file_name);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');

print($msg);
exit();

在导出到Excel时,是否有必要让JavaScript函数生效并更新最后一列?

0 个答案:

没有答案
相关问题