相同的模板,但是test.php可以加载,运行后出结果,但是使用与test.php同一个路径下的commetn.php确提示无法加载模板comment.tpl,请问如何解决?谢谢。
文件路径截图:
smarty.ini.php代码:<?php
//定义ROOT常量,用来获取smarty模板引擎的存放绝对路径
define('ROOT',str_replace('\\','/',realpath(__DIR__.'/../')));
include ROOT.'/libs/Smarty.class.php';
$smarty = new Smarty;
?>
test.php代码:<?php
include 'smarty.ini.php';
$smarty -> assign('title','1');
$smarty -> assign('content','2');
$smarty -> display('comment.tpl');
?>
commetn.php代码:<?php
include 'smarty.ini.php';
$smarty -> assign('title','HTML注释与Smarty模板引擎注释的区别');
$smarty -> assign('content','HTML注释会在页面源码中出现,而smarty注释则不会,
smarty注释的方法是在将注释内容用*号包围,而星号又被左右定界符包围。');
$smarty -> display('commetn.tpl');
?>
commetn.tppl代码:
{$title}{$content}
{* 这是smarty注释,不会被解析,无法在页面源代码中出现 *}
求大神帮忙解决,谢谢