PHP – 使用 mb_get_info() 获取 mbstring 的内部设置
PHP 中的 mb_get_info() 函数用于获取 mbstring 的内部设置。此函数在 PHP 5.4 或更高版本中受支持。
语法
array|string|int mb_get_info(str $type = "all")
参数
它仅接受一个参数来获取多字节信息。
$type − 如果未指定 type 参数或将其指定为 "all",则它将返回以下信息 −
"internal_encoding", "http_input", "http_output", "http_output_conv_mimetypes", "mail_charset", "mail_header_encoding", "mail_body_encoding", "illegal_chars", "encoding_translation", "language", "detect_order", "substitute_character", "strict_detection"
如果将 type 参数指定为以下任何一项 −
"internal_encoding", "http_input", "http_output", "http_output_conv_mimetypes", "mail_charset", "mail_header_encoding", "mail_body_encoding", "illegal_chars", "encoding_translation", "language", "detect_order", "substitute_character" or "strict_detection",
则它将返回指定的设置参数。
返回值
如果未指定 type,则 mb_get_info() 将返回一个 type 信息数组,否则,它将返回一个特定类型。失败时将返回 false。
注意 − 从 PHP 8.0.0 开始,不支持类型 "func_overload" 和 "func_overload_list"。
示例
<?php $string=mb_get_info(); print_r($string); ?>
输出
Array
(
[internal_encoding] => UTF-8
[http_output] => UTF-8
[http_output_conv_mimetypes] => ^(text/|application/xhtml\+xml)
[mail_charset] => UTF-8
[mail_header_encoding] => BASE64
[mail_body_encoding] => BASE64
[illegal_chars] => 0
[encoding_translation] => Off
[language] => neutral
[detect_order] => Array
(
[0] => ASCII
[1] => UTF-8
)
[substitute_character] => 63
[strict_detection] => Off
)
广告
数据结构
网络
关系数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP