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


PHP CHttpSession::destroy方法代码示例

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


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

示例1: actionSendMail

 public function actionSendMail()
 {
     /** @var $cs CClientScript */
     $session = new CHttpSession();
     $session->open();
     if (isset($session['orderVariations']) && is_array($session['orderVariations']) && count($session['orderVariations']) > 0) {
         $ReceiverMail = Settings::model()->find("setting_name='email_to'");
         $message_body = '<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><table>';
         $message_body .= isset($_POST['enterprise']) ? '<tr><td colspan="2">' . Yii::t('strings', 'Enterprise') . ':' . $_POST['enterprise'] . "</td></tr>" : '';
         $message_body .= isset($_POST['first_name']) ? '<tr><td colspan="2">' . Yii::t('strings', 'First Name') . ':' . $_POST['first_name'] . "</td></tr>" : '';
         $message_body .= isset($_POST['last_name']) ? '<tr><td colspan="2">' . Yii::t('strings', 'Last Name') . ':' . $_POST['last_name'] . "</td></tr>" : '';
         $message_body .= isset($_POST['address']) ? '<tr><td colspan="2">' . Yii::t('strings', 'Address') . ':' . $_POST['address'] . "</td></tr>" : '';
         $message_body .= isset($_POST['post_code']) ? '<tr><td colspan="2">' . Yii::t('strings', 'Post Code') . ':' . $_POST['post_code'] . "</td></tr>" : '';
         $message_body .= isset($_POST['city']) ? '<tr><td colspan="2">' . Yii::t('strings', 'City') . ':' . $_POST['city'] . "</td></tr>" : '';
         $message_body .= isset($_POST['tel']) ? '<tr><td colspan="2">' . Yii::t('strings', 'Telephone') . ':' . $_POST['tel'] . "</td></tr>" : '';
         $message_body .= isset($_POST['fax']) ? '<tr><td colspan="2">' . Yii::t('strings', 'Fax') . ':' . $_POST['fax'] . "</td></tr>" : '';
         $message_body .= isset($_POST['email']) ? '<tr><td colspan="2">' . Yii::t('strings', 'Email') . ':' . $_POST['email'] . "</td></tr>" : '';
         $message_body .= isset($_POST['notes']) ? '<tr><td colspan="2">' . Yii::t('strings', 'Notes') . ':' . $_POST['notes'] . "</td></tr>" : '';
         $header = 'Content-type: text/html; charset=utf-8' . "\n" . "From: " . $_POST['last_name'] . " " . $_POST['first_name'] . " <" . $_POST['email'] . ">\n";
         $aOrderVariations = $session['orderVariations'];
         foreach ($aOrderVariations as $variation_id) {
             $Product2variation = Product2variation::model()->find('variation_id=' . $variation_id);
             $product = ProductDescription::model()->find('product_id=' . $Product2variation['product_id'] . ' AND language_id=' . $this->language_id);
             $Variation = Variation::model()->find('variation_id=' . $variation_id);
             $VariationDescription = VariationDescription::model()->find('variation_id=' . $variation_id . ' AND language_id=' . $this->language_id);
             $message_body .= Yii::t('strings', '<tr><td colspan="2">' . 'Order product:') . "</td></tr>";
             $message_body .= '<tr><td><img src="' . Yii::app()->request->getBaseUrl(true) . '/uploads/images/' . $Variation['variation_image'] . '" alt="product_image" width="100" height="100"/></td>';
             $message_body .= '<td> -- ' . $VariationDescription['variation_description'] . '(' . $product['product_name'] . ')' . "</td></tr>";
         }
         $message_body .= '</table></body></html>';
         //echo json_encode(array('message' => Yii::t('strings', 'Your order was sent successfully')));
         //exit;
         if (mail($ReceiverMail['setting_value'], Yii::t('strings', 'Order'), $message_body, $header)) {
             $session->destroy();
             echo json_encode(array('message' => Yii::t('strings', 'Your order was sent successfully')));
             exit;
         }
     }
     //$this->render('sendmail');
 }
开发者ID:Kostiantin,项目名称:floors,代码行数:40,代码来源:CartController.php


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