Good morning. I have a webservice made in slimPHP. I have a class that is called control
, and it belongs to the controllers
namespace, it works normally without problems, but the need arose to import a class for PDF manipulation, so when I give it the error did not find the class requested. Does anyone know what can it be ? Follow the class.
<?php
namespace controllers {
include "fpdf/fpdf.php";
class Control {
//Atributo para banco de dados
private $PDO;
/*
__construct
Conectando ao banco de dados
*/
function __construct() {
$this->PDO = new \PDO('mysql:host=localhost;dbname=infoged', 'root',
'*******'); //Conexão
$this->PDO->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); //habilitando erros do PDO
}
public function PDF($romaneio) {
$pdf = new \fpdf\FPDF("P", "pt", "A4");
$pdf->AddPage();
}
}
}
Error:
<b>Fatal error</b>: Class 'fpdf\FPDF' not found in
<b>C:\xampp\htdocs\infoged\services\controllers\Control.php</b> on line
<b>142</b>
Starting the file FPDF
define('FPDF_VERSION', '1.81');
class FPDF {
protected $page; // current page number
protected $n; // current object number
protected $offsets; // array of object offsets
protected $buffer; // buffer holding in-memory PDF
protected $pages;
.....
}