Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Porque meu código funciona em meu note e no desktop não?
Seria a minha biblioteca de FDPF?
a qual me refiro na linha:
require('./fpdf/fpdf.php');
...
<!--relatorio_conteudo-->
<?php
require('./fpdf/fpdf.php');$header = array('Codigo', 'Conteudo do Post');
$align = array('R','C');
$width = array('15','150');
$height = 6;
$size = 12;
$dados = array();
function __construct() {
$this->FPDF('P', 'mm', 'A4');
$this->AliasNbPages();
$this->AddPage();
}
function __destruct() {
$this->Output();
}
function header() {
$this->SetTextColor(0);
/*$this->Cell(40);
$this->SetFont('Arial','B',20);
$this->Cell(120,10,utf8_decode('Relatorio de Post'),0,1,'C');*/
$this->Ln(15);
$this->SetFont('Arial','B',12);
$this->SetTextColor(255);
$this->SetFillColor(110,123,139);
for($i=0; $i<count($this->header); $i++) {
$this->Cell($this->width[$i],$this->height+1,utf8_decode($this->header[$i]),1, 0, 'L', true);}
$this->Ln();
}
function Footer() {
$this->Cell(0,0,'','T',0,'C');
$this->SetY(-20);
$this->SetFont('Times','I',8);
$this->Cell(0,10,
utf8_decode('Página ').$this->PageNo().'/{nb}','0',0,'C');
}
private function Load() {
$link = mysqli_connect("127.0.0.1","root","","db_aula");
$sql = "SELECT num_post, conteudo_post FROM tb_blog";
$rs = mysqli_query($link,$sql);$this->dados[] = $r;
}
mysqli_free_result($rs);
mysqli_close($link);
}
private function Show() {
$this->SetFont('Arial','',$this->size);
$this->SetFillColor(224,235,255);
$this->SetTextColor(0);
$this->SetDrawColor(128,128,128);
$this->SetLineWidth(.3);
$fill = false;
for($i=0; $i<count($this->dados); $i++) {
$r = $this->dados[$i];
for($j=0; $j<count($this->header); $j++) {
$this->Cell($this->width[$j], $this->height, $r[$j],
'LR', 0, $this->align[$j], $fill);
}
$this->Ln();
$fill = !$fill;
}
}
public function Report() {
$this->Load();
$this->Show();
}
}
$pdf = new PDF();
$pdf->Report();
?>
o erro apresentado no desktop:
Parse error: syntax error, unexpected '$header' (T_VARIABLE), expecting function (T_FUNCTION) in E:\trabalho\relatorio_conteudo.php on line 5
Carregando comentários...