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