例如 tid等于8if 判断 nav 目录8.htm 是否存在如果是  加载显示 8.htm 内容  如果否  泽退出

解决方案 »

  1.   

    $tid = 8;
    $file = "/nav/{$tid}.html";  //自己根据实际情况拼接成文件的绝对路径
    if (!file_exists($file)) exit();
    else {
       //"调用文件",转向指定的html文件或者include进来或者进行处理后再include进来
    }
      

  2.   

    $tid = 8;
    $path = 'nav/'.$path.'.html';  //加载的相对路径
    if (is_file($file))
    {
        include_once($file);   //加载这个文件
    }
    else exit();