<?php header("Content-type: text/html; charset=utf-8"); //设置中国时区 date_default_timezone_set('PRC'); require_once("./Smarty/libs/Smarty.class.php"); $smarty = new Smarty(); $smarty->left_delimiter="<{"; $smarty->right_delimiter="}>"; $arrs=array( array('10010','张三','男',24,6000,300), array('10010','李四','女',28,6000,350), array('10010','王五','男',26,8000,360), array('10010','赵六','女',24,12000,390) ); $smarty->assign("arrs",$arrs); // $smarty->assign("age",24); // define("DB_HOST","localhost"); $smarty->display("./view.html"); echo "<br>-----Program is Over-----";
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7 <title>view视图文件</title> 8 9 </head> 10 <body> 11 <table border="1"> 12 <{foreach $arrs as $arr}> 13 <tr> 14 <{foreach $arr as $value}> 15 <td><{$value}></td> 16 <{/foreach}> 17 </tr> 18 <{/foreach}> 19 </table> 20 </body> 21 </html>
标签:24,6000,smarty,二维,arrs,数组,array,10010 From: https://www.cnblogs.com/hnqyliu/p/17368846.html