警告:包括(includes\jconfig.php):无法打开流
Warning: include(includes\jconfig.php): failed to open stream
我已经为这个问题苦苦挣扎了两天多了。我在我的电脑上的 C:\wamp 文件夹中安装了 wamp 服务器。我的文档根目录是 C:\wamp\www.
我正在尝试使用 include 语句将子文件夹中的两个 php 文件包含到当前文件夹中的另一个代码文件中。最奇怪的是它包含一个文件而不包含另一个文件。
代码文件如下。
C:\wamp\www\jsonrpcclient\add.php
C:\wamp\www\jsonrpcclient\includes\jsonrpc.php
C:\wamp\www\jsonrpcclient\includes\jconfig.php
add.php 文件有两个 include 语句如下:
include( "includes\jsonrpc.php" );
include( "includes\jconfig.php" );
当我在浏览器中执行add.php时,出现以下错误。
( ! ) Warning: include(includes\jconfig.php): failed to open stream: No such file or directory in C:\wamp\www\jsonrpcclient\add.php on line 4
Call Stack
# Time Memory Function Location
1 0.0004 138656 {main}( ) ..\add.php:0
( ! ) Warning: include(): Failed opening 'includes\jconfig.php' for inclusion (include_path='.;C:\php\pear') in C:\wamp\www\jsonrpcclient\add.php on line 4
Call Stack
# Time Memory Function Location
1 0.0004 138656 {main}( ) ..\add.php:0
我尝试了其他帖子中提到的几种解决方案,但 none 奏效了。
两个问题中最奇怪的问题包括 jsonrpc.php 包含作品但不包括第二个 (jconfig.php)!!!为什么?两者都在 add.php
所在的当前文件夹中的同一个子文件夹中。
感谢任何帮助。提前致谢。
是的!它创建了一个全新的文件并将 jclient.php 的内容复制到其中。看起来旧文件有一些损坏。顺便说一句,我只是把包含路径中的正斜杠放回去(作为调试的一部分,我已经将它们更改为黑色斜杠)。它们仍然相对于发布的当前文件夹并且有效。感谢@Ryan Vincent 关于文件损坏这个老问题的提醒。
你需要使用打击码
include( "includes/jsonrpc.php" );
include( "includes/jconfig.php" );
或
include(__DIR__.'/includes/jsonrpc.php');
include(__DIR__.'/includes/jconfig.php');
通过替换您的代码
include( "includes\jsonrpc.php" );
include( "includes\jconfig.php" );
我已经为这个问题苦苦挣扎了两天多了。我在我的电脑上的 C:\wamp 文件夹中安装了 wamp 服务器。我的文档根目录是 C:\wamp\www.
我正在尝试使用 include 语句将子文件夹中的两个 php 文件包含到当前文件夹中的另一个代码文件中。最奇怪的是它包含一个文件而不包含另一个文件。
代码文件如下。
C:\wamp\www\jsonrpcclient\add.php
C:\wamp\www\jsonrpcclient\includes\jsonrpc.php
C:\wamp\www\jsonrpcclient\includes\jconfig.php
add.php 文件有两个 include 语句如下:
include( "includes\jsonrpc.php" );
include( "includes\jconfig.php" );
当我在浏览器中执行add.php时,出现以下错误。
( ! ) Warning: include(includes\jconfig.php): failed to open stream: No such file or directory in C:\wamp\www\jsonrpcclient\add.php on line 4
Call Stack
# Time Memory Function Location
1 0.0004 138656 {main}( ) ..\add.php:0
( ! ) Warning: include(): Failed opening 'includes\jconfig.php' for inclusion (include_path='.;C:\php\pear') in C:\wamp\www\jsonrpcclient\add.php on line 4
Call Stack
# Time Memory Function Location
1 0.0004 138656 {main}( ) ..\add.php:0
我尝试了其他帖子中提到的几种解决方案,但 none 奏效了。
两个问题中最奇怪的问题包括 jsonrpc.php 包含作品但不包括第二个 (jconfig.php)!!!为什么?两者都在 add.php
所在的当前文件夹中的同一个子文件夹中。
感谢任何帮助。提前致谢。
是的!它创建了一个全新的文件并将 jclient.php 的内容复制到其中。看起来旧文件有一些损坏。顺便说一句,我只是把包含路径中的正斜杠放回去(作为调试的一部分,我已经将它们更改为黑色斜杠)。它们仍然相对于发布的当前文件夹并且有效。感谢@Ryan Vincent 关于文件损坏这个老问题的提醒。
你需要使用打击码
include( "includes/jsonrpc.php" );
include( "includes/jconfig.php" );
或
include(__DIR__.'/includes/jsonrpc.php');
include(__DIR__.'/includes/jconfig.php');
通过替换您的代码
include( "includes\jsonrpc.php" );
include( "includes\jconfig.php" );