Einfache Verwendung von Arrays
Smartys Verwendung von Arrays: array[subscript], array.subscript
Ändern Sie die test.php-Datei:
<?php
require "./libs/Smarty.class.php";
$smarty = new Smarty;
$smarty->assign('address',
array('0', '1',
array('2--0',
'2--1')));
$smarty->display('./templates/test.html');Test.html ändern:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
</head>
<body>
<!--html的注释-->
{*smarty模板的注释*}
<!--{assign var='add' value='m.sbmmt.com'}-->
我们网站的网址是:{$address[2][0]}<br>
我们网站的网址是:{$address.2.0}
</body>
</html>wird wie folgt angezeigt:



