设置template目录有可读写权限

解决方案 »

  1.   

    <?php 
    include ("./Smarty/libs/Smarty.class.php");//包含smarty类文件
    $smarty = new Smarty();  //建立smarty实例对象$smarty
    $smarty->template_dir = './templates';
    $smarty->compile_dir  = './templates_c';
    $smarty->config_dir   = './configs';
    $smarty->cache_dir    = './cache';
    $smarty->caching      = false;
    $smarty->left_delimiter = "<{"; 
    $smarty->right_delimiter = "}>";
    $smarty->assign("title", "垃圾"); //进行模板变量替换
    $smarty->assign("content","测试用的网页内容00");
          
    //编译并显示位于./templates下的index.tpl模板
    $smarty->display("index.tpl"); //index.tpl
       ?>
      

  2.   

    应该是保证templates_c有读写权限,在templates\index.tpl这个文件确定存在的前提下。
      

  3.   

    呵呵,好久没在windows下面配置了,好像是共享该文件夹并且允许everyone r/w吧(其实应该是给通过IIS访问的用户权限,但everyone简便些,呵呵)linux下面就chmod templates_c 777就可以了