PHP之mb_internal_encoding使用

mb_internal_encoding

  • (PHP 4 >= 4.0.6, PHP 5, PHP 7)
  • mb_internal_encoding — Set/Get internal character encoding
  • 設(shè)置或獲取內(nèi)部字符集

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輸入,輸出字符編碼轉(zhuǎn)換,默認(rèn)的字符編碼由mbstring模塊字符串函數(shù)定義的。你應(yīng)該注意到內(nèi)部編碼完全不同于多字節(jié)的正則表達(dá)式。

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.

如果設(shè)置了編碼,則成功返回TRUE或失敗時(shí)返回FALSE。在這種情況下,對(duì)多字節(jié)字符編碼不改變正則表達(dá)式。如果省略編碼,則返回當(dāng)前字符編碼名稱(chēng)。

Examples

<?php
/**
 * Created by PhpStorm.
 * User: zhangrongxiang
 * Date: 2018/1/26
 * Time: 下午10:18
 */

/* Set internal character encoding to 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

文章參考

轉(zhuǎn)載注明出處

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • php.ini設(shè)置,上傳大文件: post_max_size = 128Mupload_max_filesize ...
    bycall閱讀 7,035評(píng)論 3 64
  • 1,2018年的樓市在嚴(yán)厲的市場(chǎng)調(diào)控下,整體趨勢(shì)是趨穩(wěn)的,隨著分類(lèi)調(diào)控的精細(xì)化劃分,需求被緩慢釋放,成交量有所回升...
    Heart029閱讀 176評(píng)論 0 0
  • 假期來(lái)臨,好激動(dòng)啊。該怎么過(guò)啊,字?jǐn)?shù)好像夠了。
    哎喲喂Gg閱讀 172評(píng)論 1 1
  • 當(dāng)我們滿懷喜悅或惆悵的成長(zhǎng)已經(jīng)成為一個(gè)可以被講述的故事時(shí),就會(huì)發(fā)現(xiàn)那些條條框框的目標(biāo)根本沒(méi)有實(shí)現(xiàn),可你還是...
    DT_xxxd閱讀 220評(píng)論 0 0
  • 08六項(xiàng)日精進(jìn)打卡姓名:劉海北京多禾餐飲管理限公司組別 249期謙虛1組【日精進(jìn)打卡第00125天】【知~學(xué)習(xí)】誦...
    七天樂(lè)餐閱讀 200評(píng)論 0 0

友情鏈接更多精彩內(nèi)容