Error calling a php file

0

The problem is:

Warning: include(../Vistas/plantilla.php): failed to 
open stream: No such file or directory in C:\xampp\htdocs\SAE\index.php on 
line 2

This is the template.php file

/*****************************************************************/
<!DOCTYPE html>
<html lang="en">
<head>
<?php 
include ('../Vistas/Modulos/Head.php');
?>
</head>
<body class="animsition">
<div class="page-wrapper">
    <!-- HEADER MOBILE-->
    <?php 
    include ('../Vistas/Modulos/HeaderMobile.php');
     ?>
    <!-- END HEADER MOBILE-->
    <!-- MENU SIDEBAR-->
    <?php 
    include ('../Vistas/Modulos/MenuSidebar.php');
     ?>
    <!-- END MENU SIDEBAR-->

    <!-- PAGE CONTAINER-->
    <div class="page-container">
        <!-- HEADER DESKTOP-->
        <?php 
        include ('../Vistas/Modulos/HeaderDesktop.php');
         ?>
        <!-- HEADER DESKTOP-->

        <!-- MAIN CONTENT-->
        <?php 
        include ('../Vistas/Modulos/MainContent.php');
         ?>
        <!-- END MAIN CONTENT-->
        <!-- END PAGE CONTAINER-->
    </div>

 </div>
 <?php 
 include ('../Vistas/Modulos/script.php');
 ?>
 </body>
 </html>
 <!-- end document-->

And this is the index.php file

 <?php 
 include ('../Vistas/plantilla.php');
 ?>
    
asked by ArielGamer - 004 14.11.2018 в 13:54
source

1 answer

0

The error:

  

failed to open stream: No such file or directory

indicates that the file you are trying to upload is not found , because it is not or because of a problem with the routes you are using to upload the file , and is independent of the contents of that file. If you try to load a file with an incorrect path, even if it is empty, you will have the same problem.


To load a PHP file you can check:

1. That exists . To check if a file exists, use the file_exists () function. If you have the file on disk, but it tells you that it does not exist, the route is wrong.

2. That you have access, of reading , to the file. It is less likely than the previous case, but the file could have been blocked for reading in some way. You can check if it exists and if it can be read with the function is_readable () .


Finally, when working with routes in the filesystem , to avoid problems it is recommended to use predefined constants : __FILE__ and __DIR__ .

    
answered by 14.11.2018 в 14:51