【发布时间】:2017-07-04 07:02:03
【问题描述】:
您好,这是一个简单的问题,堆栈溢出中已经存在,但我尝试了所有可能的答案,但仍未解决
我需要包含资产文件夹下的配置文件我尝试了以下代码
include_once '../config.php' ;
遇到这样的错误
Warning: include(assets/config.php): failed to open stream: No such file or directory in E:\xampp\htdocs\project\assets\handler\ContactHandler.php on line 4
Warning: include(): Failed opening 'assets/config.php' for inclusion (include_path='E:\xampp\php\PEAR') in E:\xampp\htdocs\project\assets\handler\ContactHandler.php on line 4
请建议我在 ContactHandler.php 中包含配置文件的可能方法
ContachHandler.php
<?php
include_once 'E:\xampp\htdocs\project\assets\config.php';
echo "ddddd";
exit;
include (CONTROLLER.'ContactController.php');
$form = $_POST['form'];
$cnt_controller = new ContactController();
switch ($form)
{
case 'AddContact':
$cnt_controller->AddContact($_POST);
break;
case 'ContactUs':
$cnt_controller->ContactUs($_POST);
break;
}
?>
【问题讨论】:
-
你的文件路径不正确
-
include_once '../../config.php' ;试试这个
-
include_once '../../config.php' ;或include_once '../assets/config.php' ; -
@vimal 如果路径正确,则授予您文件夹的权限。
-
我已授予文件夹@NithinJohn 的所有权限,但我仍然无法包含
标签: php phpmyadmin core