相同的模板,但是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模板引擎注釋的區(qū)別');
$smarty?->?assign('content','<b>HTML注釋會在頁面源碼中出現(xiàn),而smarty注釋則不會,
smarty注釋的方法是在將注釋內(nèi)容用*號包圍,而星號又被左右定界符包圍。</b>');
$smarty?->?display('commetn.tpl');
?>commetn.tppl代碼:<html>
<head>
<title>{$title}</title>
</head>
<body>
<!--這里是HTML注釋,會在html頁面源碼中出現(xiàn)-->
{$content}
{*?這是smarty注釋,不會被解析,無法在頁面源代碼中出現(xiàn)?*}
</body>
</html>求大神幫忙解決,謝謝
- 1 回答
- 0 關注
- 2796 瀏覽
添加回答
舉報
0/150
提交
取消