ThinkPHP数据导出为pdf文件,支持中文

thinkphp整合tcpdf插件,数据导出为pdf文件.


tcpdf插件被放在ThinkPHP/Library/Vendor文件夹下,没有的话请下载THINKPHP完整包,或者到tcpdf官网下载。

导出方法export_pdf(可放到公共类)


传入表头,表格数据,便可直接生成pdf文件:

public function index(){

       $title=array('表1','表2','表3','表4');

       $data=array(array('嘻嘻哈哈','123tcpdf','呵呵','哈哈'),array('嘻嘻哈哈','123tcpdf','呵呵','哈哈'));

       $this->export_pdf($title,$data);

   }

Comments : 1

有问题可在下面发表评论,当然没事也可以在下面吹吹牛皮、扯扯淡!
  1. 回复
    表情

发表评论

*


Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/blog/content/templates/Bitter/footer.php:40) in /www/wwwroot/blog/include/lib/view.php on line 23