【问题标题】:No such file directory exists?不存在这样的文件目录吗?
【发布时间】:2014-01-14 03:57:40
【问题描述】:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

我正在使用这个 .inc 文件将我的 php 页面链接到 MySQL,但是我的浏览器显示以下消息:

 Warning: require_once(../FinalApplicationDWP/Public_html/dbstuff.inc): failed to open stream: No such file or directory in /home/cs12jkk/public_html/functions.inc on line 6

Fatal error: require_once(): Failed opening required '../FinalApplicationDWP/Public_html/dbstuff.inc' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/cs12jkk/public_html/functions.inc on line 6

我的文件保存在我桌面上的文件 FinalApplicationDWP>public_html> 然后是所有文件

<?php

require_once ("..dbstuff.inc");
require_once ("validation.inc");

?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

【问题讨论】:

    标签: directory connection root document-root


    【解决方案1】:

    在 require_once 行中找不到文件。

    对于初学者来说尝试:

    require_once ("../dbstuff.inc");
    

    注意额外的/

    除了检查文件路径,确保它们在正确的位置。

    【讨论】:

    • 刚刚尝试过,但仍然收到相同的错误消息,感谢您的尝试:)
    • 尝试完全限定路径而不是相对路径
    【解决方案2】:

    尝试将您的代码更改为::

    <?php
    
    require_once("file:///jordanking48$/Users/jordanking48/Desktop/FinalApplicationDWP/public_html/dbstuff.inc");
    require_once ("validation.inc");
    
    ?>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    </body>
    </html>
    

    并确保为将 &lt;"..dbstuff.inc"&gt; 更改为 &lt;"../dbstuff.inc"&gt; 的文件提供正确的路径

    【讨论】:

    • 如何检查/更改路径?我已更改为代码,但仍然在网络浏览器中收到相同的错误消息。
    • 做 1 件事,检查只需将完整路径作为 file:///c:/user/......../FinalApplicationDWP/Public_html /dbstuff.inc 并检查它是否正在接收
    • 我只是复制你刚刚给出的代码吗?我应该把它放在哪里检查?
    • @user3192530 好的,只要给我你的文件位置的完整路径,比如:: c:/user.......
    • 将完整的文件位置作为文件:///c:/user............./FinalApplicationDWP/Public_html/dbstuff.inc in require_once(" //这里")
    猜你喜欢
    • 1970-01-01
    • 2018-06-18
    • 2011-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-03
    • 1970-01-01
    相关资源
    最近更新 更多