【问题标题】:How i get value from smarty array我如何从 smarty 数组中获取价值
【发布时间】:2014-03-19 09:54:42
【问题描述】:

这是我在 smarty 文件中的数组变量 {$CountKey}

这个的输出是“Array”。

我想在 smarty 文件中获取它的所有价值。

【问题讨论】:

  • 你似乎不知道变量和数组是如何工作的。只需阅读一些文档:smarty.net/docs/en/language.variables.tpl
  • 我在 smarty 中的 foreach 循环不起作用意味着我无法从该数组中获取值。 {section name=anything loop=$CountKey} {/section}
  • 对不起,这个问题太模糊了,无法回答。请阅读:stackoverflow.com/help/how-to-ask
  • smarty中如何获取数组值..?

标签: foreach smarty


【解决方案1】:

您需要使用foreach 循环从数组中获取值。

{foreach $CountKey as $row}
   <p>{$row.name}</p>
{/foreach}

这是非常基础的知识。请复习一下你对 PHP 和 Smarty 的了解。

Smarty Foreach Documentation

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多