本文整理匯總了PHP中SystemTextEncoding::currentCharsetValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP SystemTextEncoding::currentCharsetValue方法的具體用法?PHP SystemTextEncoding::currentCharsetValue怎麽用?PHP SystemTextEncoding::currentCharsetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SystemTextEncoding
的用法示例。
在下文中一共展示了SystemTextEncoding::currentCharsetValue方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getEncoding
/**
* Try to detect the current encoding (cached in session)
* @static
* @return string
*/
public static function getEncoding()
{
if (self::$currentCharsetValue == null) {
global $_SESSION;
if (isset($_SESSION["AJXP_CHARSET"]) && strlen($_SESSION["AJXP_CHARSET"])) {
// Check if the session get an assigned charset encoding (it's the case for remote SSH for example)
self::$currentCharsetValue = $_SESSION["AJXP_CHARSET"];
} else {
// Get the current locale (expecting the filesystem is in the same locale, as the standard says)
self::$currentCharsetValue = self::parseCharset(setlocale(LC_CTYPE, 0));
}
}
return self::$currentCharsetValue;
}
示例2: getEncoding
/**
* Try to detect the current encoding (cached in session)
* @static
* @return string
*/
public static function getEncoding()
{
if (self::$currentCharsetValue == null) {
$charset = ConfService::getContextCharset();
if (!empty($charset)) {
// Check if the session get an assigned charset encoding (it's the case for remote SSH for example)
self::$currentCharsetValue = $charset;
} else {
// Get the current locale (expecting the filesystem is in the same locale, as the standard says)
self::$currentCharsetValue = self::parseCharset(setlocale(LC_CTYPE, 0));
}
}
return self::$currentCharsetValue;
}