PHP: Warning: include failed to open stream no such file or directory on Windows(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 上打开流没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PHP:警告:包括未能在 Windows 上打开流没有这样的文件或目录


基础教程推荐
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- 将变量从树枝传递给 js 2022-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- Web 服务器如何处理请求? 2021-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- php中的PDF导出 2022-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- php中的foreach复选框POST 2021-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01