PHP错误无法打开流/打开失败

PHP错误无法打开流/打开失败,php,Php,以下是我的错误: 警告:包括(core/init.inc.php): 无法打开流:第2行的test.php中没有这样的文件或目录 警告:include():打开“/core/init.inc.php”失败 用于在第2行的test.php中包含(include_path=';C:\php\pear') 这是我的密码: init.inc.php <?php $path = dirname(__FILE__); include("{$path}/inc/csv.inc.php"); incl

以下是我的错误:

警告:包括(core/init.inc.php):
无法打开流:第2行的test.php中没有这样的文件或目录
警告:include():打开“/core/init.inc.php”失败
用于在第2行的test.php中包含(include_path=';C:\php\pear')
这是我的密码:

init.inc.php

<?php
$path = dirname(__FILE__);

include("{$path}/inc/csv.inc.php");
include("{$path}/inc/users.inc.php");
?>
<?php
include('/core/init.inc.php');
?>

test.php

<?php
$path = dirname(__FILE__);

include("{$path}/inc/csv.inc.php");
include("{$path}/inc/users.inc.php");
?>
<?php
include('/core/init.inc.php');
?>

正常情况下,我应该在这个白色屏幕上,但我立即得到了所有错误,有人知道这可能是什么吗

我在网上学习了本教程:(3部分)

我想我已经和教程中的一样了。但同样的做法是:


如评论中所述,您的文件不是
.inc.php
——它们被称为
.inc
。这意味着
init.inc.php
实际上并不存在,但
init.inc
确实存在

您有两个选择:

  • init.inc
    重命名为
    init.inc.php
    csv.inc
    重命名为
    csv.inc.php
    users.inc
    重命名为
    users.inc.php
  • include
    语句更改为使用
    include('core/init.inc')取而代之

尝试从
include('/core/init.inc.php')中删除前导斜杠
,让它成为
include('core/init.inc.php')
,因为
core
文件夹和
test.php
文件位于同一目录下,我也有相同的错误。您的文件名为
.inc
,而不是
.inc.php
。谢谢,混淆:有时它也恰好是名称,然后选择name.php name.php.php现在将添加扩展名不在后面。@averroken您是否在windows中创建文件?你有吗?没有,总是用Netbeans IDE 7.4创建的文件可能是通过重新安装Netbeans而破坏了我的设置。@averroken也许-听起来很奇怪,它有时能工作,有时不能。在编程中,总是有一个bug发生的原因,如果您在完全相同的硬件上遵循完全相同的工作流程,bug将始终是一致的。