TCPDF错误:已经输出了一些数据,无法发送PDF文件 [英] TCPDF ERROR: Some data has already been output, can't send PDF file

查看:225
本文介绍了TCPDF错误:已经输出了一些数据,无法发送PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试将自己的数组添加到代码中时,我一直收到此错误. 这是我的数组;

I keep receiving this error when trying to add my own array into the code. Here is my array;

$array = array();

while (odbc_fetch_row($rs))
{
$array[] = odbc_result($rs,'Product Name');
} 
$test = print_r($array);

原始代码在这里.我正在使用示例页面进行尝试,因为我知道示例页面可以正常工作.

The original code is here. I'm using an example page to try it because I know the example page works fine.

http://www.tcpdf.org/examples/example_001.phps

这段代码在$ html变量之前,设置后,我只需将$ test变量添加到$ html变量中.在添加任何代码之前,odbc连接可以正常工作,示例可以正常工作,但是在运行脚本时出现此错误;

This code is before the $html variable and when it is set I just add the $test variable into the $html variable. The odbc connection works fine and the example works fine before I add any code but when I run the script I get this error;

Array ( [0] => Test1 [1] => Test2 ) TCPDF ERROR: Some data has already been output, can't send PDF file

并且数组中还有2个以上的项.有什么想法吗?

And there is also more than 2 items in the Array. Any ideas?

推荐答案

只需使用ob_start();在页面顶部.

Just use ob_start(); at the top of the page.

这篇关于TCPDF错误:已经输出了一些数据,无法发送PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆