dy30319
2015-09-23 23:52
<?php
/** * Example Application * * @package Example-application */
require '../libs/Smarty.class.php';
$smarty = new Smarty;
//$smarty->force_compile = true;
$smarty->debugging = true;$smarty->caching = true;$smarty->cache_lifetime = 120;
$smarty->assign("Name", "Fred Irving Johnathan Bradley Peppergill", true);
$smarty->assign("FirstName", array("John", "Mary", "James", "Henry"));
$smarty->assign("LastName", array("Doe", "Smith", "Johnson", "Case"));
$smarty->assign("Class", array(array("A", "B", "C", "D"), array("E", "F", "G", "H"), array("I", "J", "K", "L"), array("M", "N", "O", "P")));
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"), array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
$smarty->assign("option_values", array("NY", "NE", "KS", "IA", "OK", "TX"));
$smarty->assign("option_output", array("New York", "Nebraska", "Kansas", "Iowa", "Oklahoma", "Texas"));
$smarty->assign("option_selected", "NE");
$smarty->display('index.tpl');
老师你好这是smarty demo中的index.php
两个问题
1、没有使用“五配置两方法”
2、程序结束没有“?>"
为什么它能运行
Smarty默认定界符就是{},单独的PHP程序可以不要?> 计算机会把<?php以后的代码都看做PHP程序来执行。在HTML中写PHP时需要?> 这样才能区分HTML代码和PHP代码
MVC架构模式分析与设计
82400 学习 · 929 问题
相似问题