Array
(
[0] => Array
(
[tourid] => 31
[sortid] => 27
[tour_title] => 北欧4国+峡湾10日
[0] => Array
(
[0] => Array
(
[tour_price_id] => 1
[tour_id] => 31
[start_time] => 07月5、12、18日
[stard_price] => 0
[more_price] => 18200
[most_price] => 0
[airline] => AY(芬兰航空)
) [1] => Array
(
[tour_price_id] => 2
[tour_id] => 31
[start_time] => 08月5、9、12、20日
[stard_price] => 0
[more_price] => 18200
[most_price] => 0
[airline] => AY(芬兰航空)
) ) ) [1] => Array
(
[tourid] => 30
[sortid] => 27
[tour_title] => 北欧4国+峡湾10日
[0] => Array
(
) ))这个是从数据库中读取出来的数据,我给存放到数组中,请问如何在模板文件中显示出来呢,关键是里边数组下标为0的那一层!!!
(
[0] => Array
(
[tourid] => 31
[sortid] => 27
[tour_title] => 北欧4国+峡湾10日
[0] => Array
(
[0] => Array
(
[tour_price_id] => 1
[tour_id] => 31
[start_time] => 07月5、12、18日
[stard_price] => 0
[more_price] => 18200
[most_price] => 0
[airline] => AY(芬兰航空)
) [1] => Array
(
[tour_price_id] => 2
[tour_id] => 31
[start_time] => 08月5、9、12、20日
[stard_price] => 0
[more_price] => 18200
[most_price] => 0
[airline] => AY(芬兰航空)
) ) ) [1] => Array
(
[tourid] => 30
[sortid] => 27
[tour_title] => 北欧4国+峡湾10日
[0] => Array
(
) ))这个是从数据库中读取出来的数据,我给存放到数组中,请问如何在模板文件中显示出来呢,关键是里边数组下标为0的那一层!!!
$data.0.tour_title
$data.0.0.0.start_time
$data.0.0.1.start_time
$data.1.tour_title
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));html今天静态页面
{section name=sec1 loop=$contacts}
phone: {$contacts[sec1].phone}<br>
fax: {$contacts[sec1].fax}<br>
cell: {$contacts[sec1].cell}<br>
{/section}
例如://=====在PHP中=====
$smarty->assign("Array",$Array);
$smarty->display("模版名");
//=====模版=====
{section name=n loop=$Array}
{$Array[n].start_time} //就可以显示出时间了
{/section}加QQ群吧: 108436639 108436639