配列の簡単な使用ログイン

配列の簡単な使用

Smarty の配列の使用: array[subscript]、array.subscript

test.php ファイルを変更します:

<?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:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>test</title>
</head>
<body>
<!--html的注释-->
{*smarty模板的注释*}
<!--{assign var='add'  value='www.php.cn'}-->
我们网站的网址是:{$address[2][0]}<br>
我们网站的网址是:{$address.2.0}
</body>
</html>

を変更すると、次のように表示されます:

微信图片_20180312151514.png

次のセクション
<?php echo "数组的简单使用";
コースウェア