本文整理汇总了PHP中QString::IsContainsUtf8方法的典型用法代码示例。如果您正苦于以下问题:PHP QString::IsContainsUtf8方法的具体用法?PHP QString::IsContainsUtf8怎么用?PHP QString::IsContainsUtf8使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QString
的用法示例。
在下文中一共展示了QString::IsContainsUtf8方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CalculateMessageHeaderAndBody
/**
* Given the way this object is set up, it will return two-index string array containing the correct
* SMTP Message Header and Message Body for this object.
*
* This will make changes, cleanup and any additional setup to the HeaderArray in order to complete its task
*
* @param string $strEncodingType the encoding type to use (if null, then it uses QApplication's)
* @param QDateTime $dttSendDate the optional QDateTime to use for the Date field or NULL if you want to use Now()
* @return string[] index 0 is the Header and index 1 is the Body
*/
public function CalculateMessageHeaderAndBody($strEncodingType = null, QDateTime $dttSendDate = null)
{
// Setup Headers
$this->RemoveHeader('Message-Id');
$this->SetHeader('From', $this->From);
$this->SetHeader('To', $this->To);
if ($dttSendDate) {
$this->SetHeader('Date', $dttSendDate->ToString(QDateTime::FormatRfc5322));
} else {
$this->SetHeader('Date', QDateTime::NowToString(QDateTime::FormatRfc5322));
}
// Setup Encoding Type (default to QApplication's if not specified)
if (!$strEncodingType) {
$strEncodingType = QApplication::$EncodingType;
}
// Additional "Optional" Headers
if ($this->Subject) {
// Encode to UTF8 Subject if Applicable
if (QString::IsContainsUtf8($this->Subject)) {
$strSubject = QString::QuotedPrintableEncode($this->Subject);
$strSubject = str_replace("=\r\n", "", $strSubject);
$strSubject = str_replace('?', '=3F', $strSubject);
$this->SetHeader('Subject', sprintf("=?%s?Q?%s?=", $strEncodingType, $strSubject));
} else {
$this->SetHeader('Subject', $this->Subject);
}
}
if ($this->Cc) {
$this->SetHeader('Cc', $this->Cc);
}
// Setup for MIME and Content Encoding
$strBoundaryArray = $this->SetupMimeHeaders($strEncodingType);
$strBoundary = $strBoundaryArray[0];
$strAltBoundary = $strBoundaryArray[1];
// Generate MessageHeader
$strHeader = $this->CalculateMessageHeader();
// Generate MessageBody
$strBody = $this->CalculateMessageBody($strEncodingType, $strBoundary, $strAltBoundary);
return array($strHeader, $strBody);
}