0
我使用Zend框架为电子邮件中的pdf附件发送凭证订单的电子邮件。一切工作正常与网站,但仅发送到pdf的失效日期有问题。我已经从我的数据库表值中传递了过期日期参数,但它总是采用一些默认值1-1-1970。我用电子邮件为pdf附件使用了以下一组代码。Zend框架无效日期
$endDate = new Zend_Date();
$endDate->set($data['voucher']['enddate']);
$endDate= $endDate->toString('dd/MM/YYYY');
//build PDF voucher attachment
$at = $this->generateVoucherPDFAttachement($recipientName, $customerName, $data['order']['msg'], $order['vouchercode'], $endDate);
$this->_helper->Mail(array(
'[email protected]' => '[email protected]',
'[email protected]' => '[email protected]',
), 'New voucher order #' . $data['order']['id'], $mailMsg, $at);
我检查了数据库中的日期为YYYY-的格式MM-dd pnly。更改了代码,但pdf仍显示1970年1月1日 $ endDate = new Zend_Date($ data ['voucher'] ['enddate'],'yyyy-MM-dd'); $ endDate-> get(Zend_Date :: DATE_FULL); $ endDatenew = $ endDate-> toString('dd/MM/YYYY'); – Anandhan
@Anandhan如果'$ endDate'变量保存了正确的日期,那么你的问题必须在你的pdf生成代码中。检查'generateVoucherPDFAttachement',答案就在那里。 – Fabio
:好的确定队友谢谢 – Anandhan