PHP:警告:包括无法在Windows上打开流无此类文件或目录 [英] PHP: Warning: include failed to open stream no such file or directory on Windows

查看:416
本文介绍了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天全站免登陆