相同的模板,但是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','<b>HTML注释会在页面源码中出现,而smarty注释则不会,
smarty注释的方法是在将注释内容用*号包围,而星号又被左右定界符包围。</b>');
$smarty -> display('commetn.tpl');
?>commetn.tppl代码:
<html>
<head>
<title>{$title}</title>
</head>
<body>
<!--这里是HTML注释,会在html页面源码中出现-->
{$content}
{* 这是smarty注释,不会被解析,无法在页面源代码中出现 *}
</body>
</html>求大神帮忙解决,谢谢
慕容粉丝
KevenHuang
随时随地看视频慕课网APP