简体   繁体   English

将 smarty 变量传递给 {php}

[英]Pass smarty variable into {php}

I need a fragment of code which will transfer a smarty object into a php variable.我需要一段将 smarty 对象传输到 php 变量的代码片段。

<h1>{$box.heading}</h1>

I need to get the {$box.heading} value.我需要获取 {$box.heading} 值。 Something like就像是

{php}
$header = {$box.heading}
{/php}

Is that even possible?这甚至可能吗? btw.顺便提一句。 it is a .tpl file它是一个 .tpl 文件

你可以用assign来做

{assign var=heading value=$box['heading']}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM