本文整理汇总了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');
}