【发布时间】:2015-09-17 12:09:29
【问题描述】:
需要帮助。在 Prestashop 中的 PaymentModule.php 中有此代码:
$params = array(
'{voucher_amount}' => Tools::displayPrice($voucher->reduction_amount, $this->context->currency, false),
'{voucher_num}' => $voucher->code,
'{firstname}' => $this->context->customer->firstname,
'{lastname}' => $this->context->customer->lastname,
'{id_order}' => $order->reference,
'{order_name}' => $order->getUniqReference()
);
我使用$params['firstname'] 向客户展示firstname,但一无所获。我在/modules/bankwire/bankwire.php中插入$params['firstname']
请告诉我哪里出错了?
谢谢
【问题讨论】:
-
从数组键中删除
{},即$params = array( 'firstname' => ...,)。 -
Kenney : 为什么你确定键是错的?这个问题被标记为
smarty和prestashop-1.6,所以它很可能是一个模板,删除花括号可能会破坏它。 -
感谢您编辑我的问题。抱歉,我是新来的,不太了解格式
-
你在哪里定义 $params 数组,你想在哪里使用条目?要么该值是真正的空,因为没有输入名字,要么涉及某种转换,例如是否存在将 $param 元素绑定到视图模板的机制?
标签: php arrays oop smarty prestashop-1.6