php不需要选择需要的文件

时间:2015-03-10 10:49:18

标签: php

我的项目有以下文件夹结构。

/MelaClass
  ../xml
    interface.php
    ../grid
       table.php

在顶部的table.php中,我使用require '../interface.php',但我得到了

  

致命错误:require():无法打开所需的' ./../ interface.php'   (include_path ='。; C:\ php \ pear')in   第3行的H:\ wamp \ www#MedICUs \ MedICUs \ MelaClass \ xml \ grid \ table.php

为什么会这样? ../是一个文件夹吗?

enter image description here

2 个答案:

答案 0 :(得分:0)

尝试使用它:

require dirname(__FILE__) . '/../interface.php';

它将获取文件目录的当前完整路径,上升一级并包含interface.php

答案 1 :(得分:0)

试试这个

dirname(dirname( __ FILE__)).'/interface.php'