gpt4 book ai didi

php - 我如何在 smarty 中使用 array_merge?

转载 作者:可可西里 更新时间:2023-11-01 00:13:18 25 4
gpt4 key购买 nike

我有两个数组 $array1$array2,我想将它们合并到 smarty 模板中以进行进一步处理。我不想在 php 中执行此操作,因为我也必须单独使用它们,如何在 smarty tpl 中合并两个数组?

最佳答案

根据你的安全配置和 smarty 版本,你可以简单地做

{assign 'array_merged' $array1|array_merge:$array2}

有关正确安全设置的更多信息,请查看此 http://www.smarty.net/docs/en/advanced.features.tpl#advanced.features.security

$php_functions is an array of PHP functions that are considered trusted and can be used from within template. To disable access to all PHP functions set $php_functions = null. An empty array ( $php_functions = array() ) will allow all PHP functions. The default is array('isset', 'empty', 'count', 'sizeof', 'in_array', 'is_array','time','nl2br').

关于php - 我如何在 smarty 中使用 array_merge?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34198737/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com