PHP:警告:包括未能在 Windows 上打开流没有这样的文件或目录 [英] PHP: Warning: include failed to open stream no such file or directory on Windows

查看:21
本文介绍了PHP:警告:包括未能在 Windows 上打开流没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 上的 xampp 上运行的 PHP 脚本中有一个 include 语句.如果我使用相对路径:

I have an include statement in a PHP script running on xampp on Windows. If I use a relative path :

include '../config/eventInfoConfig.php';  

我收到错误消息:

警告:include(../config/eventInfoConfig.php) [function.include]:打开流失败:没有这样的文件或目录

Warning: include(../config/eventInfoConfig.php) [function.include]: failed to open stream: No such file or directory

但是如果我使用绝对路径我没有错误:

But if I use the absolute path I have no error:

include 'c:/xampp/htdocs/xampp/appTrials/myApp/config/eventInfoConfig.php'; 

如何在我的包含中使用相对路径而不导致错误?

How can I use a relative path in my include without causing an error?

推荐答案

修复 include_path() 以包含正确的路径就可以了.

Fixing the include_path() to include the right path does the trick.

这篇关于PHP:警告:包括未能在 Windows 上打开流没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆