简体   繁体   English

PHP错误无法打开流:没有这样的文件或目录

[英]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在此处输入图像描述我在 php 中有这个错误,它不允许我显示表格的产品,但我不知道为什么如果我已经用地址尝试了所有内容并且它没有显示我并且相同的错误不断出现

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 .您的 include_path 丢失. for the current directory.对于当前目录。 You should adjust your php.ini config to include .您应该调整 php.ini 配置以包含. 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.或者,使用绝对路径,例如通过__DIR__而不是相对路径,您应该能够找到您的文件。

Note also a leading forward slash won't start at the web root.另请注意,前导正斜杠不会从 Web 根目录开始。 It would start at your system's root, which would be D: in your case.它将从您系统的根目录开始,在您的情况下是D: :。

You should add __DIR__ in front like so:您应该像这样在前面添加__DIR__

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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