display("handl"/> display("handl">

Home >Backend Development >PHP Tutorial > smarty施用section或者foreach循环,页面不显示

smarty施用section或者foreach循环,页面不显示

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:43:00937browse

smarty使用section或者foreach循环,页面不显示
我发现只要在html页面使用了数组循环,section,或者foreach,页面就是一片空白,数组穿过来也是有值的,如果传过来的是变量,就没问题。
比如:
$smarty->assign("title", $title);
$smarty->display("handle.html");
然后在handle.html页面使用 {/$title}就可以取出$title的值

但是如果下面这样:
$smarty->assign("array", $array);
$smarty->display("handle.html");
然后在handle.html页面使用:
{section name=item loop=$array}
    {/$array[item]}
{/section}
即如果传的是数组,页面就是一片空白,换乘foreach也是一样,
不知道我说明白了没有,望高手赐教!

循环 section foreach
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn