【发布时间】:2012-01-04 09:31:04
【问题描述】:
我正在使用 PHP 代码创建 .pdf 文件,并在该 .pdf 文件中归档表单值。
在本地主机上,代码运行良好,它创建 .pdf ,编辑 .pdf 文件 .... 但是当我将相同的代码放在另一台服务器上时,它不会创建 .pdf 并编辑到......
代码是-
<?php
date_default_timezone_set('UTC');
require('fpdf/fpdf.php');
class PDF_result extends FPDF {
function __construct ($orientation = 'P', $unit = 'pt', $format = 'Letter', $margin = 5 ) {
$this->FPDF($orientation, $unit, $format);
$this->SetTopMargin($margin);
$this->SetLeftMargin($margin);
$this->SetRightMargin($margin);
//$this->SetRightMargin1($margin1);
$this->SetAutoPageBreak(true, $margin);
}
function Header () {
//$this->SetLeftMargin(85);
$this->SetLeftMargin(5);
$this->Image('header3.jpg',25,15,560);
$this->SetLeftMargin(25);
// $this->SetFont('Arial', 'B', 20);
// $this->SetFillColor(36, 96, 84);
// $this->SetTextColor(225);
// $this->Cell(0, 30, "YouHack MCQ Results", 0, 1, 'C', true);
}
function Footer()
{
//Position at 1.5 cm from bottom
$this->SetY(-15);
//Arial italic 8
$this->SetFont('Arial','I',8);
//Page number
$this->Cell(0,10,'ifs , india',0,0,'C');
}
function Generate_Table($subjects, $marks) {
$this->SetFont('Arial', 'B', 12);
$this->SetTextColor(0);
// $this->SetFillColor(94, 188, z);
$this->SetFillColor(94, 188, 225);
$this->SetLineWidth(1);
$this->Cell(427, 25, "Subjects", 'LTR', 0, 'C', true);
$this->Cell(100, 25, "Marks", 'LTR', 1, 'C', true);
$this->SetFont('Arial', '');
$this->SetFillColor(238);
$this->SetLineWidth(0.2);
$fill = false;
for ($i = 0; $i < count($subjects); $i++) {
$this->Cell(427, 20, $subjects[$i], 1, 0, 'L', $fill);
$this->Cell(100, 20, $marks[$i], 1, 1, 'R', $fill);
$fill = !$fill;
}
$this->SetX(367);
//$this->Cell(100, 20, "Total", 1);
// $this->Cell(100, 20, array_sum($marks), 1, 1, 'R');
}
}
(代码不完整)
具体的问题是什么?
【问题讨论】:
-
您收到的确切错误/输出/警告/消息是什么?
-
ftp 不是服务器,它是传输文件的协议
-
请注意您的服务器上启用了错误记录和报告(检查您的 php.ini 配置),然后查看错误日志。它应该告诉你出了什么问题。
-
@Arfeen :我没有收到任何错误或警告,只是没有找到浏览器回复文件,这意味着 .pdf 文件。
-
@Dagon 无论其协议或服务器如何,关键是解决方案是什么? :)
标签: php javascript pdf-generation fpdf