我的控制器代码:
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中,例如代码“”等。我只是称呼图片而未在文档中调用。请告诉我,如何使代码难以辨认并根据我们编写的代码显示??
我的控制器代码:公共函数export(){标头(“ Content-Type:应用程序/vnd.msword”); header(“ Expires:0”); header(“ Cache-Control:必须重新验证,post-check = 0,pre -...