Warning: Smarty error: unable to read resource: "index.tpl" 贴出代码大家看下.
init.inc.php<?phpdefine("ROOT","E:\www\cac");includeROOT."\libs\Smarty.class.php";$tp...
init.inc.php
<?php
define("ROOT", "E:\www\cac");
include ROOT."\libs\Smarty.class.php";
$tpl=new Smarty;
$tpl->template_dir=ROOT."tpl";
$tpl->compile_dir= ROOT. "com";
$tpl->config_dir=ROOT."configs";
$tpl->caching=0;
$tpl->cache_dir=ROOT."cache";
$tpl->cache_lifetime=60*60*24;
$tpl->left_delimiter="<{";
$tpl->right_delimiter="}>";
+++++++++++++++++++++
index.php
<?php
header("Content-Type:text/html;charset=UTF-8;");
include "init.inc.php";
if(!$tpl->is_cached("index.tpl")){
for($i=0;$i<10;$i++){
$data[] = $i;
}
$data = array();
$tpl->assign("data",$data);
}
$tpl->display("index.tpl",$_SERVER['REQUEST_URI']);
出现错误
Warning: Smarty error: unable to read resource: "index.tpl" in E:\www\cac\libs\Smarty.class.php on line 1093 展开
<?php
define("ROOT", "E:\www\cac");
include ROOT."\libs\Smarty.class.php";
$tpl=new Smarty;
$tpl->template_dir=ROOT."tpl";
$tpl->compile_dir= ROOT. "com";
$tpl->config_dir=ROOT."configs";
$tpl->caching=0;
$tpl->cache_dir=ROOT."cache";
$tpl->cache_lifetime=60*60*24;
$tpl->left_delimiter="<{";
$tpl->right_delimiter="}>";
+++++++++++++++++++++
index.php
<?php
header("Content-Type:text/html;charset=UTF-8;");
include "init.inc.php";
if(!$tpl->is_cached("index.tpl")){
for($i=0;$i<10;$i++){
$data[] = $i;
}
$data = array();
$tpl->assign("data",$data);
}
$tpl->display("index.tpl",$_SERVER['REQUEST_URI']);
出现错误
Warning: Smarty error: unable to read resource: "index.tpl" in E:\www\cac\libs\Smarty.class.php on line 1093 展开
1个回答
展开全部
$tpl->template_dir=ROOT."tpl";
$tpl->compile_dir= ROOT. "com";
$tpl->config_dir=ROOT."configs";
$tpl->caching=0;
$tpl->cache_dir=ROOT."cache";
路径错误了 少了一个 "/"
$tpl->compile_dir= ROOT. "com";
$tpl->config_dir=ROOT."configs";
$tpl->caching=0;
$tpl->cache_dir=ROOT."cache";
路径错误了 少了一个 "/"
更多追问追答
追问
$tpl->template_dir=ROOT."/tpl";
$tpl->compile_dir= ROOT. "/com";
$tpl->config_dir=ROOT."/configs";
$tpl->caching=0;
$tpl->cache_dir=ROOT."/cache";
这样吗?
追答
是的
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询