라이브러리
[PHP] imap_base64 - BASE64 인코딩된 텍스트 디코딩
imap_base64란?
`imap_base64`는 PHP의 IMAP 확장 함수 중 하나로, Base64 인코딩을 지원합니다. Base64 인코딩은 8비트 문자를 6비트 문자로 변환하여 전송할 때 사용하는 인코딩 방식입니다. 이 함수는 IMAP 메시지의 본문이나 헤더를 Base64 인코딩하여 전송하거나 저장할 때 사용됩니다.
imap_base64 함수
`imap_base64` 함수는 두 개의 매개변수를 받습니다.
* `$string`: Base64 인코딩을 하려는 문자열
* `$strict`: Base64 인코딩을 할 때 엄격한 검사를 수행할지 여부 (기본값은 `false`)
함수는 `$string`을 Base64 인코딩하여 반환합니다.
예제
#hostingforum.kr
php
// Base64 인코딩을 하려는 문자열
$string = "Hello, World!";
// Base64 인코딩
$encoded_string = imap_base64($string);
// 인코딩된 문자열을 출력
echo $encoded_string . "
";
// Base64 디코딩을 하려는 문자열
$encoded_string = "SGVsbG8sIFdvcmxkIQ==";
// Base64 디코딩
$decoded_string = imap_base64decode($encoded_string);
// 디코딩된 문자열을 출력
echo $decoded_string . "
";
imap_base64decode 함수
`imap_base64decode` 함수는 Base64 디코딩을 지원합니다. 이 함수는 두 개의 매개변수를 받습니다.
* `$string`: Base64 디코딩을 하려는 문자열
* `$strict`: Base64 디코딩을 할 때 엄격한 검사를 수행할지 여부 (기본값은 `false`)
함수는 `$string`을 Base64 디코딩하여 반환합니다.
예제
#hostingforum.kr
php
// Base64 디코딩을 하려는 문자열
$encoded_string = "SGVsbG8sIFdvcmxkIQ==";
// Base64 디코딩
$decoded_string = imap_base64decode($encoded_string);
// 디코딩된 문자열을 출력
echo $decoded_string . "
";
주의
`imap_base64` 함수와 `imap_base64decode` 함수는 PHP 5.2.0 이상에서 사용할 수 있습니다. PHP 5.2.0 미만에서는 이 함수를 사용할 수 없습니다.
-
- 나우호스팅 @pcs8404
-
호스팅포럼 화이팅!
댓글목록
등록된 댓글이 없습니다.