PHP – 使用 iconv() 将字符串转换为请求的字符编码
在PHP中,该iconv()函数用于将字符串转换为请求的字符编码。它用于对字符串“string”执行从from_encoding 到 to_encoding的字符集转换。
语法
string iconv(str $from_encoding, str $to_encoding, str $string)
参数
该iconv()函数接受三个参数:$from_encoding、$to_encoding和$string。
$from_encoding-此参数用于指定输入字符集。
$to_encoding-此参数用于输出字符集。
$string-此参数用于转换字符串。
返回值
iconv()成功时返回转换后的字符串,失败时返回False。
示例
输出结果
Original:the Dollar symbol '$' TRANSLIT: the Dollar symbol '$' IGNORE: the Dollar symbol '$'
示例2
输出结果
Original: Indian Rupees '?' TRANSLIT: Indian Rupees '?' IGNORE: Indian Rupees '?'
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短