Hướng dẫn php iconv encodings - mã hóa biểu tượng php

(Php 4> = 4.0.5, Php 5, Php 7, Php 8)

ICONV - Chuyển đổi một chuỗi từ mã hóa ký tự này sang mã hóa khácConvert a string from one character encoding to another

Sự mô tả

ICONV (Chuỗi $from_encoding, Chuỗi $to_encoding, Chuỗi $string): Chuỗi | Sai(string $from_encoding, string $to_encoding, string $string): string|false

Thông số

from_encoding

Mã hóa hiện tại được sử dụng để giải thích string.

to_encoding

Sự mã hóa mong muốn của kết quả.

Nếu chuỗi //TRANSLIT được thêm vào to_encoding, thì phiên âm được kích hoạt. Điều này có nghĩa là khi một ký tự không thể được biểu diễn trong ký tự đích, nó có thể được xấp xỉ thông qua một hoặc một số ký tự nhìn tương tự. Nếu chuỗi //IGNORE được nối thêm, các ký tự không thể được biểu diễn trong ký tự đích bị loại bỏ âm thầm. Nếu không, $from_encoding0 được tạo và chức năng sẽ trả về $from_encoding1.$from_encoding0 is generated and the function will return $from_encoding1.

Thận trọng

Nếu và cách //TRANSLIT hoạt động chính xác phụ thuộc vào việc triển khai biểu tượng () của hệ thống (xem $from_encoding3). Một số triển khai được biết là bỏ qua //TRANSLIT, vì vậy việc chuyển đổi có khả năng thất bại đối với các ký tự là bất hợp pháp đối với to_encoding.$from_encoding3). Some implementations are known to ignore //TRANSLIT, so the conversion is likely to fail for characters which are illegal for the to_encoding.

string

Chuỗi sẽ được chuyển đổi.string to be converted.

Trả về giá trị

Trả về chuỗi được chuyển đổi, hoặc $from_encoding1 khi thất bại.$from_encoding1 on failure.

Ví dụ

Ví dụ #1 ICONV () Ví dụiconv() example

$from_encoding8

$from_encoding9

$to_encoding0

Ví dụ trên sẽ xuất ra một cái gì đó tương tự như:

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

Ghi chú

Ghi chú::

Các mã hóa ký tự và các tùy chọn có sẵn phụ thuộc vào việc triển khai ICONV được cài đặt. Nếu đối số với from_encoding hoặc to_encoding không được hỗ trợ trên hệ thống hiện tại, $from_encoding1 sẽ được trả về.$from_encoding1 will be returned.

Xem thêm

  • mb_convert_encoding () - Chuyển đổi chuỗi từ mã hóa ký tự này sang mã hóa khác
  • UConverter :: transcode () - Chuyển đổi chuỗi từ mã hóa ký tự này sang mã hóa khác

orrd101 tại gmail dot com

10 năm trước

$to_encoding4

$to_encoding5

$to_encoding6

$to_encoding7

$to_encoding8

$to_encoding9

$string0

$string1

Ritchie ¶

15 năm trước

$string2

$string3

$string1

Daniel Dot Rhodes tại Warpasylum Dot Co Dot Uk ¶

11 năm trước

$string5

$string6

$string1

Annuaireehtp tại Gmail Dot Com ¶

13 năm trước

$string8

$string9

from_encoding0

from_encoding1

Daniel Klein ¶

2 năm trước

from_encoding2

from_encoding3

from_encoding4

$string1

Manuel tại Kiessling Dot Net

13 năm trước

from_encoding6

from_encoding7

from_encoding8

from_encoding9

string0

Daniel Klein ¶

2 năm trước

string1

string2

string3

string4

Manuel tại Kiessling Dot Net

Zhawari tại hotmail dot com

string5

string6

string7

string8

string9

$string1

17 năm trước

Leigh Morresi ¶

14 năm trước

Daniel Klein ¶

2 năm trước

to_encoding2

to_encoding3

to_encoding4

$string1

Manuel tại Kiessling Dot Net

Zhawari tại hotmail dot com

to_encoding6

to_encoding7

$string1

17 năm trước

Leigh Morresi ¶

to_encoding9

//TRANSLIT0

//TRANSLIT1

//TRANSLIT2

$string1

14 năm trước

2 năm trước

//TRANSLIT4

//TRANSLIT5

//TRANSLIT6

//TRANSLIT7

Manuel tại Kiessling Dot Net

2 năm trước

//TRANSLIT8

Manuel tại Kiessling Dot Net

15 năm trước

//TRANSLIT9

to_encoding0

to_encoding1

$string1

Daniel Dot Rhodes tại Warpasylum Dot Co Dot Uk ¶

11 năm trước

to_encoding3

to_encoding4

to_encoding5

$string1

Annuaireehtp tại Gmail Dot Com ¶

Zhawari tại hotmail dot com

to_encoding7

to_encoding8

to_encoding9

$string1

17 năm trước

11 năm trước

//IGNORE1

//IGNORE2

//IGNORE3

//IGNORE4

Annuaireehtp tại Gmail Dot Com ¶

13 năm trước

2 năm trước

//IGNORE6

Daniel Klein ¶

2 năm trước

//IGNORE7

//IGNORE8

//IGNORE9

$from_encoding00

Manuel tại Kiessling Dot Net

13 năm trước

$from_encoding01

Daniel Klein ¶

Zhawari tại hotmail dot com

$from_encoding02

17 năm trước

Zhawari tại hotmail dot com

$from_encoding03

17 năm trước

Leigh Morresi ¶

$from_encoding04

$from_encoding05

$string1

14 năm trước

Zhawari tại hotmail dot com

$from_encoding07

$from_encoding08

$from_encoding09

$from_encoding10

$from_encoding11

$from_encoding12

$string1

17 năm trước

13 năm trước

$from_encoding14

Daniel Klein ¶

15 năm trước

$from_encoding15

Daniel Dot Rhodes tại Warpasylum Dot Co Dot Uk ¶

11 năm trước

$from_encoding16

$from_encoding17

$string1

Annuaireehtp tại Gmail Dot Com ¶

13 năm trước

$from_encoding19

$from_encoding20

$string1

Daniel Klein ¶

15 năm trước

$from_encoding22

$from_encoding23

$from_encoding24

$string1

Daniel Dot Rhodes tại Warpasylum Dot Co Dot Uk ¶

13 năm trước

$from_encoding26

$from_encoding27

$string1

Daniel Klein ¶

Zhawari tại hotmail dot com

$from_encoding29

17 năm trước

Zhawari tại hotmail dot com

$from_encoding30

17 năm trước

Leigh Morresi ¶

$from_encoding31

$from_encoding32

$from_encoding33

$from_encoding34

$string1

14 năm trước

2 năm trước

$from_encoding36

$from_encoding37

$string1

Manuel tại Kiessling Dot Net

Leigh Morresi ¶

$from_encoding39

14 năm trước

13 năm trước

$from_encoding40

$from_encoding41

from_encoding8

$from_encoding43

$from_encoding44

Daniel Klein ¶

Zhawari tại hotmail dot com

$from_encoding45

$from_encoding46

$from_encoding47

$from_encoding48