虚拟主机www.xxx.cn   下有文件夹aaa  里面有文件aaa.class.php
即www.xxx.cn/aaa/aaa.class.php
aaa下还有一个文件夹bbb  里面的文件demo.php  要用到aaa.class.php
既www.xxx.cn/aaa/bbb/demo.php
那么require("./aaa/aaa.class.php");为什么报错,说找不到文件

解决方案 »

  1.   

    那么同样的问题:虚拟主机www.xxx.cn下:---+smarty----+Smarty.class.php 
                                       ¦ 
                                       +www-----------+smarty.inc.php 
                                                      ¦ 
                                                      +index.php   [require("smarty.inc.php")] 
    ------------------------------------------------------------------ 
    则:smarty.inc.php中是这样写的:  define("SMARTY_DIR","./smarty/"); 
     define("WWW",SMARTY_DIR."/www/"); 
     require_once(SMARTY_DIR."Smarty.class.php"); 
    但是 报错了:Warning: require_once(..Smarty.class.php) [function.require-once]: failed to open stream: No such file or directory in /home/acruxcn/public_html/zxs/smarty/www/smarty.inc.php on line 4 
    路径出错,应该怎么改正呢?
      

  2.   

    sorry  出来的效果有点不对劲。 
    www文件夹在smarty文件夹下面的 
    www.xxx.cn/smarty/www
      

  3.   

    require_once("../Smarty.class.php");试试看
      

  4.   

    这样肯定可以,关键是我想定义SMARTY_DIR 和 WWW 这两个常量,以后很多地方要用!