 |
|
จะเขียนว่า ให้เข้าไปที่ folder news แล้วไป open > read file $address_news($address_news เป็นชื่อไฟล์.txt ครับ)
<?
include('config.inc.php');
$sql="select*from news where head='$head'";
$rs=mssql_query($sql);
$result= mssql_fetch_array($rs);
$id_news=$result[id_news];
$head=$result[head];
$address_news=$result[address_news];
define('FPDF_FONTPATH','C:\AppServ\www\test\fonts/');
require('fpdf.php');
$objOpen = opendir("news"); //1
//$strFileName=$address_news; //2
$objFopen = fopen($address_news, 'r'); //3 บรรทัดนี้แหละมั้งครับที่ต้องแก้ไข
$pdf=new FPDF();
$pdf->AddPage();
$pdf->AddFont('angsana','','angsa.php');
$pdf->SetFont('angsana','',16);
if ($objFopen) {
while (!feof($objFopen)) {
$file = fgets($objFopen, 4096);
$pdf->Cell(0,10,$file ,0,1);
$pdf->Ln(10);
}
fclose($objFopen);
}
$pdf->Output();
?>
รันแล้วมันขึ้นอย่างงี้
Warning: fopen(ว.txt) [function.fopen]: failed to open stream: No such file or directory in C:\AppServ\www\test\news.php on line 13
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\test\news.php:13) in C:\AppServ\www\test\fpdf.php on line 1017
FPDF error: Some data has already been output, can't send PDF file
Tag : PHP, Ms SQL Server 2008
|
|
 |
 |
 |
 |
Date :
2010-08-24 21:46:34 |
By :
pop |
View :
980 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |