error: failed to open stream: No such file or directory in

1

I'm organizing the folders of a CRUDizinho that I'm doing here. I have a problem though. Thanks guys!

.

listarMotos.php

function__autoload($classes){include("../classes/{$classes}.php");
}
require_once '../includes/topo.php';
require_once '../includes/menu.php';

    
asked by anonymous 05.07.2018 / 19:32

2 answers

1

It is recommended to use the function below for autoload. The names in the file_exists will depend on the folders that are in your class files. I just considered your classes folder.

spl_autoload_register(function ($class){
  if(file_exists('classes/'.$class.'.php')) {
    require_once 'classses/'.$class.'.php';
  }
});

I hope I have helped.

Reference: link

    
05.07.2018 / 21:14
1

I browsed everything on the internet and found:

<?php
include(dirname(__FILE__) . "/includes/topo.php");
include(dirname(__FILE__) . "/includes/menu.php");
?>

The error still occurs: failed to open stream: No such file or directory.

It's annoying: (

    
06.07.2018 / 02:04