當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CakeText::UUID方法代碼示例

本文整理匯總了PHP中CakeText::UUID方法的典型用法代碼示例。如果您正苦於以下問題:PHP CakeText::UUID方法的具體用法?PHP CakeText::UUID怎麽用?PHP CakeText::UUID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CakeText的用法示例。


在下文中一共展示了CakeText::UUID方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getHeaders

 /**
  * Get list of headers
  *
  * ### Includes:
  *
  * - `from`
  * - `replyTo`
  * - `readReceipt`
  * - `returnPath`
  * - `to`
  * - `cc`
  * - `bcc`
  * - `subject`
  *
  * @param array $include List of headers.
  * @return array
  */
 public function getHeaders($include = array())
 {
     if ($include == array_values($include)) {
         $include = array_fill_keys($include, true);
     }
     $defaults = array_fill_keys(array('from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'bcc', 'subject'), false);
     $include += $defaults;
     $headers = array();
     $relation = array('from' => 'From', 'replyTo' => 'Reply-To', 'readReceipt' => 'Disposition-Notification-To', 'returnPath' => 'Return-Path');
     foreach ($relation as $var => $header) {
         if ($include[$var]) {
             $var = '_' . $var;
             $headers[$header] = current($this->_formatAddress($this->{$var}));
         }
     }
     if ($include['sender']) {
         if (key($this->_sender) === key($this->_from)) {
             $headers['Sender'] = '';
         } else {
             $headers['Sender'] = current($this->_formatAddress($this->_sender));
         }
     }
     foreach (array('to', 'cc', 'bcc') as $var) {
         if ($include[$var]) {
             $classVar = '_' . $var;
             $headers[ucfirst($var)] = implode(', ', $this->_formatAddress($this->{$classVar}));
         }
     }
     $headers += $this->_headers;
     if (!isset($headers['X-Mailer'])) {
         $headers['X-Mailer'] = static::EMAIL_CLIENT;
     }
     if (!isset($headers['Date'])) {
         $headers['Date'] = date(DATE_RFC2822);
     }
     if ($this->_messageId !== false) {
         if ($this->_messageId === true) {
             $headers['Message-ID'] = '<' . str_replace('-', '', CakeText::UUID()) . '@' . $this->_domain . '>';
         } else {
             $headers['Message-ID'] = $this->_messageId;
         }
     }
     if ($include['subject']) {
         $headers['Subject'] = $this->_subject;
     }
     $headers['MIME-Version'] = '1.0';
     if (!empty($this->_attachments)) {
         $headers['Content-Type'] = 'multipart/mixed; boundary="' . $this->_boundary . '"';
     } elseif ($this->_emailFormat === 'both') {
         $headers['Content-Type'] = 'multipart/alternative; boundary="' . $this->_boundary . '"';
     } elseif ($this->_emailFormat === 'text') {
         $headers['Content-Type'] = 'text/plain; charset=' . $this->_getContentTypeCharset();
     } elseif ($this->_emailFormat === 'html') {
         $headers['Content-Type'] = 'text/html; charset=' . $this->_getContentTypeCharset();
     }
     $headers['Content-Transfer-Encoding'] = $this->_getContentTransferEncoding();
     return $headers;
 }
開發者ID:xplico,項目名稱:CapAnalysis,代碼行數:75,代碼來源:CakeEmail.php


注:本文中的CakeText::UUID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。