unset不是一个函数,只是一个语句,没有返回值.所以不能用@

解决方案 »

  1.   

    可以了。之前忽略了文件名的变化。现在是另外的错误了。Fatal error: Cannot instantiate non-existent class: smarttemplate我的引用是require_once('include/template.php');正常呀。
      

  2.   

    require("include/config.inc.php");
    $tpl = new SmartTemplate($style_template.'/header.htm');
    其中include/config.inc.php:
    require_once('include/template.php');
      

  3.   

    试一下这个
    config.inc.php里
    require_once(dirname(__FILE__).'/template.php');
      

  4.   

    路径包含的很模糊,如果包含多了很容易搞错.
    建议使用一个常量来标识根目录, 或使用dirname( __FILE__ ) 来做当前目录,
    这个是绝对路径,不会出问题.
      

  5.   

    /******************************************
    函数:find_dir($dir,$level=0)
    功能:获得$level级的上层目录
    参数:$dir,目录路径
    参数:$level,回退层数
    备注:none
    ******************************************/  
    function find_dir($dir,$level=0)
    {
    if (strstr($dir,"/"))
    $pat='/';
    else
    $pat='\\';
    if ($level!=0)
    {
    $dir_arr=explode($pat,$dir);
    $num=count($dir_arr);
    for ($p=1;$p<=$level;$p++)
    {
    unset($dir_arr[$num-$p]);
    }
    $dir=implode($pat,$dir_arr);
    }
    return $dir;
    }