Smarty 模板 从php分配的变量 数组
index.php:
$smarty = new Smarty;
$smarty->assign('Contacts',
array('555-222-9876',
'zaphod@slartibartfast.com',
array('555-444-3333',
'555-111-1234')));
$smarty->display('index.tpl');
index.tpl:
{$Contacts[0]}<br>
{$Contacts[1]}<br>
{* you can print arrays of arrays as well *}
{$Contacts[2][0]}<br>
{$Contacts[2][1]}<br>
OUTPUT:
555-222-9876<br>
zaphod@slartibartfast.com<br>
555-444-3333<br>
555-111-1234<br>
相关文档:
When I deploy php application on apache, some problem come out, and solved. Here's the tips and problems solved.
0.How could I deploy an apache server armed with php, mysql, perl, and phpMyAdmin on the fly?
You need a package bundled with all these tools, xampp shall meet you needs, you can ......
我使用WAMP5 version 1.7.4安装PHP+Apache+MySQL集成环境,在调试一个程序时,其验证码不能显示,试了好多次,修改了很多地方也没能成功。已做好的配置如下:
①在phpinf页面Loaded Configuration File后面所指定的php.ini中把;extension=php_gd2.dll前面的;去掉。
②重启了Apache服务器。
麻� ......
互联网的今天,AJAX已经不是什么陌生的词汇了。说起AJAX,可能会立即想起因RSS而兴起的XML。XML的解析,恐怕已经不是什么难题
了,特别是PHP5,大量的XML解析器的涌现,如最轻量级的SimpleXML。不过对于AJAX来说,XML的解析更倾向于前台Javascript
的支持度。我想所有解析过XML的人,都会因树和节点而头大。不可否认,X ......
index.php:
$smarty = new Smarty;
$smarty->assign('Contacts',
array('555-222-9876',
'zaphod@slartibartfast.com',
array('555-444-3333',
'555-111-1234')));
$smarty->display('index.tpl');
index.tpl:
{$Contacts[0]}<br>
{$Contacts[1]}<br>
{* you can print arrays of arrays ......