ob_get_contents

(PHP 4, PHP 5, PHP 7, PHP 8)

ob_get_contents — Return the contents of the output buffer


설명

ob_get_contents(): string|false

지우지 않고 출력 버퍼의 내용을 가져옵니다.


매개변수

이 함수에는 매개변수가 없습니다.


반환 값

출력 버퍼링이 활성화되지 않은 경우 출력 버퍼의 내용을 반환하거나 false를 반환합니다.


Examples

예제 #1 simple ob_get_contents() 예제

                  
<?php

ob_start();

echo "Hello ";

$out1 = ob_get_contents();

echo "World";

$out2 = ob_get_contents();

ob_end_clean();

var_dump($out1, $out2);
?>
                  
                

위의 예는 다음을 출력합니다.

string(6) "Hello "
string(11) "Hello World"
                

기타