Does not recognize the class using @include_once

0

I am separating my project by classes and I have 2 files: "security.php" and "enginetablemysql.php" and they are located in this way in the directive

/DeliveryAQP
  |--/security
  |    |--security.php
  |--/enginetables
  |    |--enginetablemysql.php
  |--index.php

The "Security" class is a singleton and is imported by enginetablemysql.php like this:

@include_once '../security/security.php';

And in the EngineTable class I call my singleton "Security" in the constructor like this:

class EngineTable{
    private $table_name;
    ....
    public $security;

    function __construct($new_table_name, int $new_cost = 0){
        $this->security = Security::getInstance();
        $this->table_name = $new_table_name;
        $this->bool_columns_name = false;
        if ($new_cost != 0)
            $this->cost = $new_cost;
    }

And I get this error:

  

Fatal error: Uncaught Error: Class 'Security' not found in C: \ xampp \ htdocs \ DeliveryAQP \ enginetables \ enginetablemysql.php: 101 Stack trace: # 0 C: \ xampp \ htdocs \ DeliveryAQP \ loginclientes.php ( 11): EngineTable-> __ construct ('tbllogincliente') # 1 C: \ xampp \ htdocs \ DeliveryAQP \ index.php (6): LoginClients->> construct () # 2 {main} thrown in C: \ xampp \ htdocs \ DeliveryAQP \ enginetables \ enginetablemysql.php on line 101

I have passed the class to the same file of enginetablemysql.php and there if the Security class recognizes me; but when I import it for @include_once I do not recognize the class, is it because it's a singleton?

    
asked by Armando Hinojosa Ccama 21.04.2018 в 03:47
source

0 answers