本文整理匯總了PHP中Zend_Mime::encodeBase64方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Mime::encodeBase64方法的具體用法?PHP Zend_Mime::encodeBase64怎麽用?PHP Zend_Mime::encodeBase64使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Mime
的用法示例。
在下文中一共展示了Zend_Mime::encodeBase64方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _encodeHeader
/**
* Encode header fields
*
* Encodes header content according to RFC1522 if it contains non-printable
* characters.
*
* @param string $value
* @return string
*/
protected function _encodeHeader($value)
{
if (Zend_Mime::isPrintable($value)) {
return $value;
} elseif ($this->_encodingOfHeaders === Zend_Mime::ENCODING_QUOTEDPRINTABLE) {
$quotedValue = Zend_Mime::encodeQuotedPrintable($value);
$quotedValue = str_replace(array('?', ' ', '_'), array('=3F', '=20', '=5F'), $quotedValue);
return '=?' . $this->_charset . '?Q?' . $quotedValue . '?=';
} elseif ($this->_encodingOfHeaders === Zend_Mime::ENCODING_BASE64) {
return '=?' . $this->_charset . '?B?' . Zend_Mime::encodeBase64($value) . '?=';
} else {
/**
* @todo 7Bit and 8Bit is currently handled the same way.
*/
return $value;
}
}
示例2: testBase64
public function testBase64()
{
$content = str_repeat("И™ѓњ)И™ѓњ)И™ѓ", 4);
$encoded = Zend_Mime::encodeBase64($content);
$this->assertEquals($content, base64_decode($encoded));
}