【发布时间】:2015-06-17 12:31:45
【问题描述】:
您好,我可以使用以下代码。导出功能工作正常,但没有导出图像,为什么?请帮帮我。
<?php
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/vnd.ms-excel; charset=UTF-8");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=member_list.xls");
?>
<table cellpadding="0" cellspacing="0" border="0" class="table table-bordered">
<thead>
<tr><th colspan="6"><h3>Member List</h3></th></tr>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Phone No</th>
<th>Date of Birth</th>
<th>Profile Image</th>
<th>Status</th>
<th>InsertDate</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($memberlist))
{
foreach ($memberlist as $row){ ?>
<tr class="gradeX odd">
<td><strong><?php echo $row->id;?></strong></td>
<td><?php echo $row->display_name;?></td>
<td><?php echo $row->user_email;?></td>
<td><?php echo $row->phone;?></td>
<td><?php echo $row->dob;?></td>
<td><img src="<?php echo base_url().'uploads/images/member/'.$row->profile_image;?>" width="80" height="65" /><?php echo base_url().'uploads/images/member/'.$row->profile_image;?></td>
<?php
if($row->is_active == 1)
{
?>
<td>Active</td>
<?php
}
else
{
?>
<td>Inactive</td>
<?php
}
?>
<td><?php echo $row->insertdate;?></td>
</tr>
<?php } } ?>
</tbody>
</table>
?>
如何将我的 Excel 导出为显示图像的一列。我们需要这个包含八列的导出文件,如果它们在我的数据中找到,第六列是显示图像。
【问题讨论】:
-
这不是 Excel 文件,只是扩展名为 .xls 的 html 标记
-
而且您确实意识到只有最后一个 Content-Type 标头(您尝试设置的 4 个标头)将发送到浏览器
标签: php html excel codeigniter