require_once 和 include 有 php.ini 个问题
require_once and include are having php.ini issues
您好,当我 运行 包含
的 index.php 文件时,我收到了这个错误
require_once("system/config.php");
我想知道这条消息是什么意思,我该如何解决这个问题。因为这个网站在我 运行 直接在我的 Mac.
上工作正常
require_once(): Failed opening required 'system/core.php' (include_path='.:/usr/share/php')
以下所有答案均正确!
但是我的问题是 CHMOD 问题我有 644 而不是 744
这通常意味着您试图包含路径不正确的文件。当您尝试完整路径时会发生什么?
require_once(getcwd() . 'system/config.php');
你的脚本现在的样子,它正在寻找具有如下目录结构的文件:
file.php <- is calling the require_once()
- system <- the system directory
- config.php <- the config file
但这不是它所在的路径。
文件system/core.php
需要相对于声明行require_once("system/core.php");
(即system/config.php
)的文件或包含system
的目录必须在你的 include_path
。在 Mac 上搜索 core.php
。检查 Mac.
上的配置设置 (include_path
)
您好,当我 运行 包含
的 index.php 文件时,我收到了这个错误require_once("system/config.php");
我想知道这条消息是什么意思,我该如何解决这个问题。因为这个网站在我 运行 直接在我的 Mac.
上工作正常 require_once(): Failed opening required 'system/core.php' (include_path='.:/usr/share/php')
以下所有答案均正确! 但是我的问题是 CHMOD 问题我有 644 而不是 744
这通常意味着您试图包含路径不正确的文件。当您尝试完整路径时会发生什么?
require_once(getcwd() . 'system/config.php');
你的脚本现在的样子,它正在寻找具有如下目录结构的文件:
file.php <- is calling the require_once()
- system <- the system directory
- config.php <- the config file
但这不是它所在的路径。
文件system/core.php
需要相对于声明行require_once("system/core.php");
(即system/config.php
)的文件或包含system
的目录必须在你的 include_path
。在 Mac 上搜索 core.php
。检查 Mac.
include_path
)