php smarty加载失败,smarty模板无法加载如何解决?

相同的模板,但是test.php可以加载,运行后出结果,但是使用与test.php同一个路径下的commetn.php确提示无法加载模板comment.tpl,请问如何解决?谢谢。

文件路径截图:

4eaa935304998286b04684bf2b59d93d.png

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注释,不会被解析,无法在页面源代码中出现 *}

求大神帮忙解决,谢谢

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值