我的控制器代码:
public function export()
{
header("Content-Type: application/vnd.msword");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-disposition: attachment; filename=\"Proposal TJSLP (".date('d-m-Y H:i:s').").doc\"");
$where = array('usulan_id' => $this->uri->segment(4));
$data['data'] = $this->data_model->export_usulan($where)->result();
$this->load->view("usulan_export", $data);
}
我的观点 :
<?php foreach ($data as $key => $h) { ?>
<center>
<h1>PROPOSAL</h1>
<h3>
((Nama Perusahaan)) <br> TAHUN <?php echo date('Y'); ?> <br><br><br>
<?php echo $h->nama; ?>
</h3>
</center>
<?php } ?>
回报是:
导出到 DOC 是可行的,但是我视图中编写的所有代码也出现在 doc 中,例如代码“”等。我只是调用了图片在文档中没有调用。请告诉我,如何使代码难以辨认并根据我们编写的代码出现??