-2

我是 Smarty 的新手。我有一个聪明的阵列$order_info

如何将值分配给{$order_info.email}PHP 字符串?

我希望有一个人可以帮助我!

解决方案:

{/php}
     {$order_info.email}
{php}
4

1 回答 1

0

根据http://www.smarty.net/docs/en/language.function.assign.tpl您应该能够运行以下代码:

智能模板

{assign var="email" value=$order_info.email}

PHP 脚本

// First fetch the template!
$whole_page = $smarty->fetch('index.tpl');

// Then get the variable:
$email = $smarty->getTemplateVars('email');
echo "The email in a PHP variable: " . $email;
于 2013-08-06T15:08:26.233 回答