Регистрация Войти
Войти через VK Войти через FB Войти через Google Войти через Яндекс
Войти через VK Войти через FB Войти через Google Войти через Яндекс
Поиск по сайту
Locale::acceptFromHttp
locale_accept_from_http
(PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
Locale::acceptFromHttp -- locale_accept_from_http — Tries to find out best available locale based on HTTP "Accept-Language" header
Описание
Объектно-ориентированный стиль
public static string Locale::acceptFromHttp ( string $header )Процедурный стиль
string locale_accept_from_http ( string $header )Tries to find locale that can satisfy the language list that is requested by the HTTP "Accept-Language" header.
Список параметров
header -
The string containing the "Accept-Language" header according to format in RFC 2616.
Возвращаемые значения
The corresponding locale identifier.
Примеры
Пример #1 locale_accept_from_http() example
$locale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
echo $locale;
Пример #2 OO example
$locale = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']);
echo $locale;
Результат выполнения данного примера:
en_US
Смотрите также
- locale_lookup() - Searches the language tag list for the best match to the language
Описание класса locale, примеры использования класса locale.
Описание на ru2.php.netОписание на php.ru