Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用freemarker,有什么方法可以间接引用一个值...
<#assign apple=fruit> <#assign item=apple> ${${item}}
在事先不知道可能包含什么价值项目的情况下产生输出“水果”?
您可以尝试使用eval 内置:
${item?eval}
不过,这只有在item包含有效表达式时才有效。还有一个interpret内置的将您的字符串视为完整模板,我自己没有使用过。
item
interpret