本文整理匯總了PHP中Zend\Mail\Message::headers方法的典型用法代碼示例。如果您正苦於以下問題:PHP Message::headers方法的具體用法?PHP Message::headers怎麽用?PHP Message::headers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Mail\Message
的用法示例。
在下文中一共展示了Message::headers方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getMessage
public function getMessage()
{
$message = new Message();
$message->addTo('zf-devteam@zend.com', 'ZF DevTeam')->addCc('matthew@zend.com')->addBcc('zf-crteam@lists.zend.com', 'CR-Team, ZF Project')->addFrom(array('zf-devteam@zend.com', 'Matthew' => 'matthew@zend.com'))->setSender('ralph.schindler@zend.com', 'Ralph Schindler')->setSubject('Testing Zend\\Mail\\Transport\\Sendmail')->setBody('This is only a test.');
$message->headers()->addHeaders(array('X-Foo-Bar' => 'Matthew'));
return $message;
}
示例2: prepareHeaders
/**
* Prepare header string from message
*
* @param Message $message
* @return string
*/
protected function prepareHeaders(Message $message)
{
$headers = new Headers();
foreach ($message->headers() as $header) {
if ('Bcc' == $header->getFieldName()) {
continue;
}
$headers->addHeader($header);
}
return $headers->toString();
}
示例3: prepareHeaders
/**
* Prepare the textual representation of headers
*
* @param Message $message
* @return string
*/
protected function prepareHeaders(Message $message)
{
$headers = $message->headers();
// On Windows, simply return verbatim
if ($this->isWindowsOs()) {
return $headers->toString();
}
// On *nix platforms, strip the "to" header
$headersToSend = new Headers();
foreach ($headers as $header) {
if ('To' == $header->getFieldName()) {
continue;
}
$headersToSend->addHeader($header);
}
return $headersToSend->toString();
}