PHP之mb_internal_encoding()函数使用说明

岳小威子
2022-07-01 / 155 个字 / 0 评论 / 22 阅读 / 加载耗时:38ms / 正在检测是否收录...
温馨提示:
本文最后更新于2022年06月29日,已超过876天没有更新,若内容或图片失效,请留言反馈。

mb_internal_encoding()

(PHP 4 >= 4.0.6, PHP 5, PHP 7)
mb_internal_encoding — Set/Get internal character encoding
设置或获取内部字符集

描述/Description

mixed mb_internal_encoding ([ string $encoding = mb_internal_encoding() ] )
//Set/Get the internal character encoding

参数编码/Parameters encoding

encoding is the character encoding name used for the HTTP input character encoding conversion, HTTP output character encoding conversion, and the default character encoding for string functions defined by the mbstring module. You should notice that the internal encoding is totally different from the one for multibyte regex.

字符编码用于HTTP输入,输出字符编码转换,默认的字符编码由mbstring模块字符串函数定义的。你应该注意到内部编码完全不同于多字节的正则表达式。

返回值/Return Values

If encoding is set, then Returns TRUE on success or FALSE on failure. In this case, the character encoding for multibyte regex is NOT changed. If encoding is omitted, then the current character encoding name is returned.

如果设置了编码,则成功返回TRUE或失败时返回FALSE。在这种情况下,对多字节字符编码不改变正则表达式。如果省略编码,则返回当前字符编码名称。

示例/Examples

<?php
/* 
 * Set internal character encoding to UTF-8 
 * 设置内部字符编码为UTF-8
 */
mb_internal_encoding("UTF-8");
/* 
 * Display current internal character encoding 
 * 显示当前内部字符编码
 */
echo mb_internal_encoding().PHP_EOL; // UTF-8

mb_internal_encoding("GBK");
echo mb_internal_encoding().PHP_EOL; //CP936
mb_internal_encoding("CP936");
echo mb_internal_encoding().PHP_EOL; //CP936

mb_internal_encoding("iso-8859-1");
echo mb_internal_encoding().PHP_EOL; //ISO-8859-1
?>

文章到这里就结束了

您在本文章已经停留了大概
喜欢的话就点个赞吧!或着请我喝个冰可乐,我就太感谢你了!


0
打赏
拜谢打赏(☆ω☆)

感谢老板,老板大气。。

评论 (0)

取消