include failed to open stream

0

Ladies and gentlemen, please help me.

I have a clients.php file, which has a table of clients to fill.

The data that will populate this table is in the class Customer.php.

I'm therefore using a 'Client.php' include at the beginning of the file, as follows:

<?php 

include 'Classes / Template / Client.php'; ? >                            

<title>Clientes | </title>
mais algum código html...

The Client.php file also has an 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, it's giving the following error:

  

Warning: include (Persistence / ClientCRUD.php): failed to open stream: No such file or directory in C: \ xampp \ htdocs \ inove \ gentelella-master \ production \ Classes \ Model \ Client.php on line 3

Well, honestly, I do not know what's going on. The file 'clients.php' is located in the production directory. The file 'Cliente.php' is in production / Classes / Model / The file 'ClienteCRUD.php' is in production / Classes / Persistence.

People, I've done enough research, but I honestly do not know what's wrong. Please, if you can help me, I will be very grateful, as I am standing still on this project because of this.

I have to use PHP without any framework help.

Thank you

    
asked by anonymous 28.07.2017 / 20:34

1 answer

2

You can use magic constant :

require __DIR__ . '/../Persistencia/ClienteCRUD.php';

It contains the directory of the file, and the directory name does not have a / bar at the end, unless it is the root directory / , so remember to put the bar if it is not in the root .

    
28.07.2017 / 21:08