2
例如,我有这个疑问在我news.php文件:PHP和Smarty的执行
$sql = 'SELECT * FROM `news` ORDER BY `id` DESC LIMIT 0, 5';
$result = mysql_query($sql) or die("Query failed : " . mysql_error());
while ($line = mysql_fetch_assoc($result)) {
$value[] = $line;
}
// Assign this array to smarty...
$smarty->assign('news', $value);
// Display the news page through the news template
$smarty->display('news.tpl');
然而,在我news.tpl文件,我不会把{$}新闻变量。当我浏览news.php时,查询是否仍然会执行,否则它会被忽略?