显示带有异常消息的变量值


showing variable value with exception message

我正在尝试通过用非常基本的方法检查每个阶段的变量/对象来调试发票问题......

我有以下代码

$capOrder = $payment->getOrder();
$capTransID = $capOrder->getPayment()->getLastTransId();
if(!empty($capTransID )){
Mage::throwException(Mage::helper('paygate')->__('zaffar_checking for trans  ID. its not EMPTY'));
}

我的输出看起来像

zaffar_checking 对于 trans ID。 它不为空

我也想用我的自定义错误消息回显$capTransID的值......喜欢

zaffar_checking 对于 trans ID,它不为空 - 值为 XXXX

我该怎么做??我找不到将变量与错误消息组合/连接的方法。

将其更改为

if(!empty($capTransID )){
Mage::throwException(Mage::helper('paygate')->__("zaffar_checking for trans  ID. its not EMPTY--value is $capTransID"));
}