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 上打开流没有这样的文件或目录


基础教程推荐
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 如何替换eregi() 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01