【问题标题】:.tpl using php cant access the value that is store on index.tpl 使用 php 无法访问存储在索引上的值
【发布时间】:2021-03-25 17:51:54
【问题描述】:
{LOOP: QUESTIONS}
  <div class="submit-field">
    <h5>{VALUE}</h5>
    <input name="answers[]" required="">
  </div>
{/LOOP: QUESTIONS}

PHP 代码:

$item_questions = ['Question 1', 'Questions 2']
$page->SetLoop('QUESTIONS', $item_questions);

如何显示问题的价值?

【问题讨论】:

  • 请使用正确的标签。这与Task Parallel Library 无关

标签: php laravel oop smarty


【解决方案1】:

在 Smarty 中,您需要使用 foreach 循环:

{foreach from=$QUESTIONS item=question}
  <div class="submit-field">
    <h5>{$question}</h5>
    <input name="answers[]" required />
  </div>
{/foreach}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-11-07
    • 2020-05-14
    • 1970-01-01
    • 1970-01-01
    • 2016-06-16
    • 2011-08-14
    • 2021-12-04
    • 1970-01-01
    相关资源
    最近更新 更多