pets511 发表于 2013-05-07 17:05

在iis环境下php使用smarty不能够生成编译文件

在smarty.php中有如下代码:

include_once('../Smarty/Smarty.class.php');
$smarty = new Smarty();
$smarty ->template_dir = "../templates/"; //设置模板目录
$smarty ->compile_dir = "../souces/news/"; //设置目编辑目录
$smarty ->cache_dir = "../cache/"; //设置绶存
$smarty ->cache_lifetime = 60*60*24; //设置绶存时间
$smarty ->caching=false;
$smarty ->force_compile=true;//强制重新生成编译文件
$smarty ->left_delimiter = "<{"; //定义左定界符
$smarty ->right_delimiter = "}>"; //定义右定界符

在index.php文件中有如下代码:
include('../include/config.php');
header( "Content-Type:text/html; charset=utf-8 ");
include('smarty.php');

$WebTitle="页面标题";
$smarty->assign("WebTitle",$WebTitle);
$smarty -> display('news.htm');

在news.htm文件中如下代码:
<title>-<{$WebTitle}></title>

在本地测试和unix下使用都正常,但当在IIS6windonws2003环境下,打开是标题是空白,什么也不显示。还来经查找原因是在souces/news/文件夹下没有生成%%6A^6AD^6AD15A0D%%news.htm.php这样一个编译文件,导至什么都不显示。把本机上的这个文件传到服务器上就能正常显示了。删除%%6A^6AD^6AD15A0D%%news.htm.php编译文件后,smarty不能够自动生成这样一个编译文件。现在求怎么样让smarty能够自已生成编译文件?

xinglu1983 发表于 2013-05-07 17:11

检查路径,大小写。

pets511 发表于 2013-05-07 19:03

回复 2# xinglu1983


    谢谢,路径大小写什么都没有错。因为/souces/news/文件夹下还能实时生成wrt82B4.tmp类似于这样的临时文件。

maochanglu 发表于 2013-05-08 10:56

估计是权限问题。把html目录换到非C盘看看。

pets511 发表于 2013-05-08 15:41

回复 4# maochanglu


    感谢你的回复,IIS来宾帐户都给与读取、修改、写入权限了。并且 能够在/souces/news/文件夹下还能实时生成wrt82B4.tmp类似于这样的临时文件。如果权限有问题的话,应该是不能实时生成类似于这样的临时文件的。

hbeimf 发表于 2013-05-08 15:09

这个没碰到过,很少用iis服务器,,

pets511 发表于 2013-05-08 15:55

回复 5# hbeimf

客户指定的没有办法。


   
页: [1]
查看完整版本: 在iis环境下php使用smarty不能够生成编译文件