本文整理匯總了PHP中MailSo\Base\Utils::IsIconvSupported方法的典型用法代碼示例。如果您正苦於以下問題:PHP Utils::IsIconvSupported方法的具體用法?PHP Utils::IsIconvSupported怎麽用?PHP Utils::IsIconvSupported使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MailSo\Base\Utils
的用法示例。
在下文中一共展示了Utils::IsIconvSupported方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: CharsetDetect
/**
* @param string $sStr
*
* @return string
*/
public static function CharsetDetect($sStr)
{
$mResult = '';
if (!\MailSo\Base\Utils::IsAscii($sStr)) {
$mResult = \MailSo\Base\Utils::IsMbStringSupported() && \MailSo\Base\Utils::FunctionExistsAndEnabled('mb_detect_encoding') ? @\mb_detect_encoding($sStr, 'auto', true) : false;
if (false === $mResult && \MailSo\Base\Utils::IsIconvSupported()) {
$mResult = \md5(@\iconv('utf-8', 'utf-8//IGNORE', $sStr)) === \md5($sStr) ? 'utf-8' : '';
}
}
return \is_string($mResult) && 0 < \strlen($mResult) ? $mResult : '';
}
示例2: EncodedValue
/**
* @return string
*/
public function EncodedValue()
{
$sResult = $this->sFullValue;
if ($this->IsSubject()) {
if (!\MailSo\Base\Utils::IsAscii($sResult) && \MailSo\Base\Utils::IsIconvSupported() && \function_exists('iconv_mime_encode')) {
$aPreferences = array('scheme' => \MailSo\Base\Enumerations\Encoding::BASE64_SHORT, 'input-charset' => \MailSo\Base\Enumerations\Charset::UTF_8, 'output-charset' => \MailSo\Base\Enumerations\Charset::UTF_8, 'line-length' => \MailSo\Mime\Enumerations\Constants::LINE_LENGTH, 'line-break-chars' => \MailSo\Mime\Enumerations\Constants::CRLF);
return \iconv_mime_encode($this->Name(), $sResult, $aPreferences);
}
} else {
if ($this->IsParameterized() && $this->oParameters && 0 < $this->oParameters->Count()) {
$sResult = $this->sValue . '; ' . $this->oParameters->ToString(true);
} else {
if ($this->IsEmail()) {
$oEmailCollection = \MailSo\Mime\EmailCollection::NewInstance($this->sFullValue);
if ($oEmailCollection && 0 < $oEmailCollection->Count()) {
$sResult = $oEmailCollection->ToString(true, false);
}
}
}
}
return $this->NameWithDelimitrom() . $this->wordWrapHelper($sResult);
}