Problem with PHP file path

0
<html>
 <head>
    <meta charset="utf-8">
    <title></title>
 </head>
<body>
    <?php
    require_once "Sistema Web/Data.php";

    $d = new Data();

    $productos = $d->getProductos();

    foreach ($productos as $p) {
      echo $p->id." - ".$p->nombre." - ".$p->precio." - ".$p->stock;
      echo "<br>";
  }

   ?>
</body>
</html>

I do not understand why I get that error I assume that it has to do something with the file paths but I have them in the www / Web System folder.

    
asked by Steven Andrade 28.04.2018 в 16:14
source

1 answer

0

If you have all your files in the wamp/www/Sistema Web directory where you place the route, it should look like this:

require_once "Data.php";

If you have to access the folder where the file is, it will be the way you do:

TuDirectorio/Data.php

It is recommended not to use spaces in directory names like the name you gave to

wamp/www/Sistema Web

You should rename it to wamp/www/Sistema_Web or wamp/www/SistemaWeb without spaces

    
answered by 28.04.2018 в 16:55