close

 


參數說明
如果你在 out_charset 後添加了字符串 //TRANSLIT,
將啟用轉寫(transliteration)功能。這個意思是,
當一個字符不能被目標字符集所表示時,它可以通過一個或多個形似的字符來近似表達。
如果你添加了字符串 //IGNORE,不能以目標字符集表達的字符將被默默丟棄。
否則,str 從第一個無效字符開始截斷並導致一個 E_NOTICE。

例子

<?php
$text = "This is the Euro symbol '€'.";

echo 'Original : ', $text, PHP_EOL;
echo 'TRANSLIT : ', iconv("UTF-8", "ISO-8859-1//TRANSLIT", $text), PHP_EOL;
echo 'IGNORE : ', iconv("UTF-8", "ISO-8859-1//IGNORE", $text), PHP_EOL;
echo 'Plain : ', iconv("UTF-8", "ISO-8859-1", $text), PHP_EOL;

?>
以上例程的輸出類似於:

Original : This is the Euro symbol '€'.
TRANSLIT : This is the Euro symbol 'EUR'.
IGNORE : This is the Euro symbol ''.
Plain :
Notice: iconv(): Detected an illegal character in input string in .\iconv-example.php on line 7
This is the Euro symbol '

arrow
arrow
    全站熱搜

    stockwfj3 發表在 痞客邦 留言(0) 人氣()