简体   繁体   中英

PHP error Failed to open stream: No such file or directory

enter image description here I have this error in php that does not let me show the products of a table but I have no idea why if I already tried everything with the address and it does not show me and the same error keeps appearing

This is my code

<center><h1>Datos del producto</h1></center>
<center>
    <table border="1"> </center>
        <tr>
            <th>ID</th>
            <th>Nombre</th>
            <th>Tipo</th>
            <th>Precio</th>
            <th>Cantidad</th>
            <th>ID Vendedor</th>
            <th>Imagen</th>
            <th>Descripcion</th>
            <?php include ("/Modelo/S_Mostrar.php") ?>
        </tr>
    </table>

enter image description here

Your include_path is missing . for the current directory. You should adjust your php.ini config to include . for the current directory. Alternatively, use absolute paths such as through __DIR__ rather than relative paths and you should be able to find your files.

Note also a leading forward slash won't start at the web root. It would start at your system's root, which would be D: in your case.

You should add __DIR__ in front like so:

<?php include __DIR__ . '/Modelo/S_Mostrar.php' ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM