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

Asked

Viewed 597 times

0

I am organizing the folders of a little Bill that I am doing here. however I have a big problem. Thank you guys!

inserir a descrição da imagem aqui.

listarMotos.php

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

inserir a descrição da imagem aqui

  • And the folder modais?

  • I am not using the modal folder in the list fileMotos.php. The intention is just the top.php and menu.php

2 answers

1

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

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

I hope I’ve helped.

Reference: http://php.net/manual/en/language.oop5.autoload.php

0

I went online and found:

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

Still, it makes the mistake: failed to open stream: No such file or directory.

it’s bullshit :(

Browser other questions tagged

You are not signed in. Login or sign up in order to post.