1
Ladies and gentlemen, please help me.
I have a.php client file, which has a client table to fill.
The data that will fill this table is in the Client.php class.
I am therefore using a include 'Client.php' at the beginning of the file, as follows:
<?php
include 'Classes/Template/Client.php'; ?>
<title>Clientes | </title>
mais algum código html...
The.php Client file also has a include, as follows:
<?php
include 'Persistencia/ClienteCRUD.php';
class Cliente {
private $cpf;
private $nome;
private $crud;
public function __construct() {
$this->crud = new ClienteCrud();
}
public function getCpf() {
return $this->cpf;
}
public function getNome() {
return $this->nome;
}
public function setCpf($cpf) {
$this->cpf = $cpf;
}
public function setNome($nome) {
$this->nome = $nome;
}
public function inserir() {
return $this->crud->create($this);
}
public function alterar() {
$this->crud->update($this);
}
public function excluir() {
$this->crud->delete($this);
}
public function listar() {
$result = $this->crud->read();
return $result;
}
}
?>
Well, the following mistake is making:
Warning: include(Persistencia/Clientecrud.php): failed to open stream: No such file or directory in C: xampp htdocs inove gentelella-master Production Classes Modelo Cliente.php on line 3
Well, honestly, I don’t know what’s going on. The 'clients.php' file is located in the Production directory. The file 'Client.php' is in Production/Classes/Template/ The file 'Clientecrud.php' is in Production/Classes/Persistence.
Guys, I’ve done a lot of research, but I honestly don’t know what’s wrong. Please, if you can help me, I’ll be very grateful, because I’m stuck on this project just because of this.
NOTE: I have to use PHP without any help from any framework.
Thank you
Go back to a directory like this
include '../Persistencia/ClienteCRUD.php';
– KevinF
Same error: Warning: include(../Persistencia/Clientecrud.php): failed to open stream: No such file or directory in C: xampp htdocs inove gentelella-master Production Classes Template Client.php on line 3 This is what I’m missing... And the file is there. It doesn’t seem to recognize '.. /' as 'going back to a directory'
– Gabriel Augusto
@Gabrielaugusto as this the directory structure of his project?
– gato
where this class is located Client ?, do the following get the two paths and compare them to see if everything is as desired.
– 13dev
Try to do:
require __DIR__ . '/../Persistencia/ClienteCRUD.php';
– gato
@cat *gentelella-master **Production ***Classes ****Bank *****Connection.php ****Model *****Client.php ****Persistencia *****Sign up client.php &#### ***clients. Sorry, I’m not used to using stackoverflow, so I don’t know which is the right way to represent a directory here. Anyway, I can send the github link where the project is, if allowed. Thank you
– Gabriel Augusto
back 2 directories...
../../Persistencia/ClienteCRUD.php
– Daniel Omine
@cat Pus require DIR . '/../Persistence/Clientecrud.php' in this class and another class that Clientecrud.php also requires, and it worked well. I’m using the absolute path, doing this, right? Thank you so much for your help. I believe I have to do this for all requires of all other classes, right? Guys, thanks. In case I have another problem of this type I will post!
– Gabriel Augusto
@Gabrielaugusto I use this magic constant in my projects, I suggest you do for the other paths.
– gato