为了账号安全,请及时绑定邮箱和手机立即绑定

Smarty


<?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、程序结束没有“?>"

为什么它能运行

正在回答

3 回答

Smarty默认定界符就是{},单独的PHP程序可以不要?> 计算机会把<?php以后的代码都看做PHP程序来执行。在HTML中写PHP时需要?> 这样才能区分HTML代码和PHP代码

0 回复 有任何疑惑可以回复我~
#1

dy30319 提问者

非常感谢!
2015-09-25 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信