Home >Backend Development >PHP Tutorial >PHP:Failed opening required

PHP:Failed opening required

WBOY
WBOYOriginal
2016-06-06 20:42:041623browse

当前目录下有2个文件:1.php和2.php

1.php代码

<code><?php require "./2.php";//报错:Failed opening required
require "2.php";//正常运行
?>
</code>

Server API:ISAPI
PHP:5.2.17
服务器:IIS 6.0

回复内容:

当前目录下有2个文件:1.php和2.php

1.php代码

<code><?php require "./2.php";//报错:Failed opening required
require "2.php";//正常运行
?>
</code>

Server API:ISAPI
PHP:5.2.17
服务器:IIS 6.0

解决办法:文件明明存在,却require_once(./*.php)出错

是不是命令行执行的? 命令行下的当前目录并不是脚本文件目录. 你可以使用 getcwd()输出看一下

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn