PHP ob_get_contents()関数
例
出力バッファの内容を変数に格納します。
<?php
ob_start();
echo "Hello World!";
$contents =
ob_get_contents();
ob_end_clean();
echo "The contents of the buffer
are: ";
echo $contents;
?>
定義と使用法
このob_get_contents()
関数は、最上位の出力バッファーの内容を返します。
構文
ob_get_contents();
技術的な詳細
戻り値: | バッファの内容を含む文字列を返します |
---|---|
PHPバージョン: | 4.3+ |
❮PHP出力制御関数