PHP - 使用 mb_get_info() 获取 mbstring 的内部设置
mb_get_info()PHP中的函数用于获取mbstring的内部设置。PHP5.4或更高版本支持此功能。
语法
array|string|int mb_get_info(str $type = "all")
参数
它只接受一个参数来获取多字节信息。
$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"
如果类型参数指定为以下任何一项-
"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",
然后它将返回指定的设置参数。
返回值
mb_get_info()如果未指定类型,则返回类型信息数组,否则返回特定类型。它会在失败时返回false。
注意-从PHP8.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 )