当前位置: 首页>>代码示例>>PHP>>正文


PHP MailTemplate::parseSubject方法代码示例

本文整理汇总了PHP中MailTemplate::parseSubject方法的典型用法代码示例。如果您正苦于以下问题:PHP MailTemplate::parseSubject方法的具体用法?PHP MailTemplate::parseSubject怎么用?PHP MailTemplate::parseSubject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MailTemplate的用法示例。


在下文中一共展示了MailTemplate::parseSubject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: order

 public static function order($name, $email = '', $phone = '', $address = '', $comment = '', $adminNotifyTplID = 'admin_purchase_notify', $customerNotifyTplID = 'user_purchase_notify')
 {
     global $db;
     $user = \cf\User::getLoggedIn();
     $productList = '';
     $products = \cf\api\cart\getList();
     if (!array_key_exists('contents', $products) || !count($products['contents'])) {
         return false;
     }
     $tpl = new MailTemplate('order');
     execQuery("\n\t\t\tINSERT INTO cf_orders (created,customer_name, customer_email, customer_phone, customer_address, customer_comments, comments)\n\t\t\tVALUES(NOW(),:name, :email, :phone, :address, :comments, :contents)", array('name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address, 'comments' => $comment, 'contents' => $tpl->parseBody(array('cart' => $products))));
     $orderId = $db->lastInsertId();
     $msgParams = array('name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address, 'comment' => $comment, 'order' => $orderId, 'total' => $products['total'], 'products' => $products['contents']);
     \cf\api\cart\clear();
     $mail = new \PHPMailer();
     $mail->CharSet = 'UTF-8';
     if ($adminNotifyTplID) {
         $tpl = new MailTemplate($adminNotifyTplID);
         $mail->Subject = $tpl->parseSubject($msgParams);
         $mail->MsgHTML($tpl->parseBody($msgParams));
         foreach ($tpl->recipients() as $address) {
             $mail->addAddress($address);
         }
         $mail->Send();
     }
     $mail->clearAddresses();
     if ($customerNotifyTplID && $email) {
         $tpl = new MailTemplate($customerNotifyTplID);
         $mail->Subject = $tpl->parseSubject($msgParams);
         $mail->MsgHTML($tpl->parseBody($msgParams));
         $mail->addAddress($email);
         $mail->Send();
     }
     return $orderId;
 }
开发者ID:sd-studio,项目名称:sh,代码行数:35,代码来源:cart.php

示例2: order

 public static function order($name, $email = '', $phone = '', $address = '', $comment = '', $notifyGroup = 'admin', $notifyCustomer = true)
 {
     global $db;
     $user = \cf\User::getLoggedIn();
     $productList = '';
     $products = \cf\api\cart\getList();
     if (count($products) < 2) {
         return false;
     }
     for ($i = 1; $i < count($products); ++$i) {
         $productList .= "{$products[$i]['id']} {$products[$i]['name']} [{$products[$i]['price']}] - {$products[$i]['amount']} <br>";
     }
     $productList .= "<br><strong>Итого</strong>: {$products[0]['total_price']}";
     execQuery("\n\t\t\tINSERT INTO cf_orders (created,customer_name, customer_email, customer_phone, customer_address, customer_comments, comments)\n\t\t\tVALUES(NOW(),:name, :email, :phone, :address, :comments, :products)", array('name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address, 'comments' => $comment, 'products' => $productList));
     $orderId = $db->lastInsertId();
     \cf\api\cart\clear();
     $msgParams = array('name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address, 'comment' => $comment, 'order' => $orderId, 'total' => array_shift($products), 'products' => $products);
     if ($notifyGroup) {
         $emails = query2vector("SELECT email FROM cf_users INNER JOIN cf_user_roles ON cf_users.id=cf_user_roles.user_id WHERE cf_user_roles.role_id=:id", array('id' => $notifyGroup));
         if (!empty($emails)) {
             $tpl = new MailTemplate('admin_purchase_notify');
             $mail = new \PHPMailer();
             $mail->CharSet = 'UTF-8';
             $mail->Subject = $tpl->parseSubject($msgParams);
             $mail->MsgHTML($tpl->parseBody($msgParams));
             foreach ($emails as $a) {
                 $mail->AddAddress($a);
             }
             $mail->Send();
         }
     }
     if ($notifyCustomer && $email) {
         $tpl = new MailTemplate('user_purchase_notify');
         $mail = new \PHPMailer();
         $mail->CharSet = 'UTF-8';
         $mail->Subject = $tpl->parseSubject($msgParams);
         $mail->MsgHTML($tpl->parseBody($msgParams));
         $mail->AddAddress($email);
         @$mail->Send();
     }
     return $orderId;
 }
开发者ID:sd-studio,项目名称:or,代码行数:42,代码来源:cart.php


注:本文中的MailTemplate::parseSubject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。