【问题标题】:Dynamic keys in fat-free framework无脂肪框架中的动态键
【发布时间】:2013-04-09 07:08:27
【问题描述】:

为了访问在 html 页面上的 php 脚本中创建的数组,我们这样做{{@somearray['somevalue']}}

我们如何处理从其他数组{{@someotherarray['someotherindex'}}获取密钥('somevalue')的情况
(即{{@someotherarray['someotherindex']}} = somevalue 的值)?

我使用的是 F3 版本 2.1.x。

【问题讨论】:

  • 只是猜测,你试过{{@somearray[{{@someotherarray['someotherindex']}}]}}吗?
  • 是的,先生。浏览器的输出是` ] }}`。
  • 另一个猜测:P {{@index = @someotherarray['someotherindex']}} {{@somearray[@index]}}
  • 作为 v2 中的一种解决方法,您可以使用 {{F3::set('somevalue',F3::get('someotherarray.someotherindex'))}} 在模板中设置新变量
  • 投反对票的请解释一下。

标签: php fat-free-framework


【解决方案1】:

这已在 3.x 中修复,在 2.x 中不起作用。

3.x 中的语法是:{{@arr1.@arr2.@field}}

【讨论】:

  • 我通过改变业务逻辑完全采用了不同的方法。谢谢你的回答:)
猜你喜欢
  • 2020-12-19
  • 1970-01-01
  • 2014-02-06
  • 1970-01-01
  • 2015-04-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多