大网数据广告活动
PHP 语言与运行手册

bind_textdomain_codeset · Specify or get the character encoding in which the messages from the DOMAIN message catalog will be returned

· 52CE 我爱测

bind_textdomain_codeset — Specify or get the character encoding in which the messages from the DOMAIN message catalog will be returned

bind_textdomain_codeset

(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)

bind_textdomain_codeset — Specify or get the character encoding in which the messages from the DOMAIN message catalog will be returned

Description

function bind_textdomain_codeset(string $domain, ?string $codeset = null): string|false

bind_textdomain_codeset() allows to set or get the encoding in which messages from domain will be returned by gettext() and similar functions.

Parameters

domain

The domain.

codeset

The code set. If null, the currently set encoding is returned.

Return Values

Returns the encoding currently set for domain, or false if none has been set or on failure. On musl prior to 1.2.6, false is always returned.

Errors/Exceptions

Throws a ValueError if domain is the empty string or longer than 1024 bytes.

Changelog

Version Description
8.4.0 Now throws a ValueError if domain is the empty string.
8.4.0 codeset is optional now. Previously, the parameter always had to be specified.
8.0.3 codeset is nullable now. Previously, it was not possible to retrieve the currently set encoding.
8.0.0 Now throws a ValueError if domain is too long. Previously, an E_WARNING was raised and false was returned.

Notes

Note:

The bind_textdomain_codeset() information is maintained per process, not per thread.

来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
PHP Documentation Group
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。