亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Simple use of objects

The declaration of objects is the same as that of variables, and is declared through assign

Modify the test.php file:

<?php
require "./libs/Smarty.class.php";
$smarty = new Smarty;
class Person{
    public $name="smile";
    public $age=25;
}
$person=new Person();
$smarty->assign('address',$person);
$smarty->display('./templates/test.html');

Modify the test.html file:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>test</title>
</head>
<body>
<!--html的注釋-->
{*smarty模板的注釋*}
我叫{$address->name}今年{$address->age}歲<br>
</body>
</html>

The running display is as follows:

微信圖片_20180312153413.png

Continuing Learning
||
<?php echo "對象的使用";
submitReset Code