Multibyte mb_output_handler

(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)

mb_output_handler — 콜백 함수는 출력 버퍼의 문자 인코딩을 변환합니다.


설명

mb_output_handler(string $string, int $status): string

mb_output_handler()ob_start() 콜백 함수입니다. mb_output_handler()는 출력 버퍼의 문자를 내부 문자 인코딩에서 HTTP 출력 문자 인코딩으로 변환합니다.


매개변수

string
출력 버퍼의 내용입니다.
status
출력 버퍼의 상태입니다.

반환 값

변환된 문자열입니다.


Examples

예제 #1 mb_output_handler() 예제

                  
<?php
mb_http_output("UTF-8");
ob_start("mb_output_handler");
?>
                  
                

메모

메모

이미지와 같은 이진 데이터를 출력하려면 이진 데이터를 클라이언트로 보내기 전에 header()를 사용하여 Content-Type: 헤더를 설정해야 합니다(예: header("Content-Type: image/png")). . Content-Type: 헤더가 전송되면 출력 문자 인코딩 변환이 수행되지 않습니다.

'Content-Type: text/*'가 전송되면 콘텐츠 본문은 텍스트로 간주됩니다. 변환이 수행됩니다.


기타