Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
703 views
in Technique[技术] by (71.8m points)

php - TCPDF ERROR: Some data has already been output, can't send PDF file

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

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...