$row,"array4"=>$row2));在此定义了数组{%foreach "/> $row,"array4"=>$row2));在此定义了数组{%foreach ">

Heim  >  Artikel  >  Backend-Entwicklung  >  求php数组在Smarty模版页循环显示有关问题

求php数组在Smarty模版页循环显示有关问题

WBOY
WBOYOriginal
2016-06-13 13:44:36830Durchsuche

求php数组在Smarty模版页循环显示问题
$row2=explode('______',$conne->getRowsArray($sql));
$smarty->assign(array("array3"=>$row,"array4"=>$row2));

在此定义了数组
{%foreach item=i from=$array3%}
{%foreach item=j from=$array4%}//这里开始循环array,在这样里怎么才可以循环出数组的内容。
{%if $i!="guid"%}


  {%$i|replace:"__":" "%}
 
  (中文) (ENGLISH)
 
 
{%/if%}
{%/foreach%}
{%/foreach%}

------解决方案--------------------
探讨
{%foreach item=j from=$array%}//这里开始循环array,在这样里怎么才可以循环出数组的内容。

------解决方案--------------------
那说明你的当前的$j是字符串,那么你要{% $j %}就行了
------解决方案--------------------
探讨

读不到值,输出的全是大写A {%$j[0]%}

------解决方案--------------------
你可以现在php页面echo '
';print_r($array);exit;看看里面的结构,根据结构在smarty中调用,要不你把echo出的结果发出来我帮你看看
<br><font color="#e78608">------解决方案--------------------</font><br>哈哈,这个看着$j就是字符串Array呗
<br><font color="#e78608">------解决方案--------------------</font><br>你可以这样调用<br>{% $j[0].guid %}这样,其他的一样,要多研究现,要多练习,那样很容易就找到规律了
<br><font color="#e78608">------解决方案--------------------</font><br>上面说错了<br>是{% $j.guid %} <div class="clear">
                 
              
              
        
            </div>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn