实际上,我正在研究Codigniter adminpanel模块,我实现了一个模块,我想在单独的列中提供下载链接,如何提供帮助。
'static
这是我的代码:views.php
1) i Want (**Files List**) column need to give download link.
脚本:
<table class="table table-hover" id="dataTables-tenant">
<thead>
<tr>
<th><input type="checkbox" data-note="tooltip" data-placement="top" data-original-title="Check/Uncheck all" class="check-all"></th>
<th>File Name</th>
<th>File title</th>
<th>Files List</th>
<th>created at</th>
<th>updated at</th>
<!-- <a href="http://localhost/fre/admin/uploads/" download="w3logo">
<img border="0" src="http://localhost/fre/admin/uploads/.'$Knowledge_id'" alt="W3Schools" width="104" height="142">
</a> -->
<th class="text-center">Actions</th>
</tr>
</thead>
</table>
答案 0 :(得分:0)
在项目中创建下载文件并将数据发送到该文件
例如:
download.php
<?php
// Save File
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$filename = "Perfomance_Appraisal.docx";
$objWriter->save($filename);
// The following offers file to user on client side: deletes temp version of file
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$filename);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($filename));
flush();
// or echo($filename)
readfile($filename);
unlink($filename); // deletes the temporary file
您还可以使用以下库: