本文整理匯總了PHP中MailSo\Base\Utils::StrMailDomainToLowerIfAscii方法的典型用法代碼示例。如果您正苦於以下問題:PHP Utils::StrMailDomainToLowerIfAscii方法的具體用法?PHP Utils::StrMailDomainToLowerIfAscii怎麽用?PHP Utils::StrMailDomainToLowerIfAscii使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MailSo\Base\Utils
的用法示例。
在下文中一共展示了Utils::StrMailDomainToLowerIfAscii方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: IdnToAscii
/**
* @param string $sStr
* @param bool $bLowerIfAscii = false
*
* @return string
*/
public static function IdnToAscii($sStr, $bLowerIfAscii = false)
{
$sStr = $bLowerIfAscii ? \MailSo\Base\Utils::StrMailDomainToLowerIfAscii($sStr) : $sStr;
$sUser = '';
$sDomain = $sStr;
if (false !== \strpos($sStr, '@')) {
$sUser = \MailSo\Base\Utils::GetAccountNameFromEmail($sStr);
$sDomain = \MailSo\Base\Utils::GetDomainFromEmail($sStr);
}
if (0 < \strlen($sDomain) && \preg_match('/[^\\x20-\\x7E]/', $sDomain)) {
try {
$sDomain = self::idn()->encode($sDomain);
} catch (\Exception $oException) {
}
}
return ('' === $sUser ? '' : $sUser . '@') . $sDomain;
}
示例2: UpdateDependentValues
public function UpdateDependentValues()
{
$this->Value = \trim($this->Value);
$this->ValueCustom = \trim($this->ValueCustom);
$this->TypeStr = \trim($this->TypeStr);
$this->ValueLower = '';
if (0 < \strlen($this->Value)) {
// lower
if ($this->IsEmail()) {
$this->Value = \MailSo\Base\Utils::StrMailDomainToLowerIfAscii($this->Value);
}
if ($this->IsName()) {
$this->Value = \MailSo\Base\Utils::StripSpaces($this->Value);
}
// lower value for searching
if ($this->IsValueForLower() && \MailSo\Base\Utils::FunctionExistsAndEnabled('mb_strtolower')) {
$this->ValueLower = (string) @\mb_strtolower($this->Value, 'UTF-8');
}
// phone value for searching
if ($this->IsPhone()) {
$sPhone = \trim($this->Value);
$sPhone = \preg_replace('/^[+]+/', '', $sPhone);
$sPhone = \preg_replace('/[^\\d]/', '', $sPhone);
$this->ValueCustom = \trim($sPhone);
}
}
}