<?php
/**
 * Link         :   http://www.phpcorner.net
 * User         :   qingbing<780042175@qq.com>
 * Date         :   2018-12-07
 * Version      :   1.0
 */

namespace Helper;

/**
 * Ob输出缓冲
 * Class ObBuffer
 * @package Helper
 */
class ObBuffer
{
    /**
     * 开始缓冲区
     */
    public static function start()
    {
        ob_start();
        ob_implicit_flush(false);
    }

    /**
     * 结束缓冲区
     * @param bool $return
     * @return mixed
     */
    public static function end($return = true)
    {
        if ($return) {
            return ob_get_clean();
        }
        echo ob_get_clean();
        return null;
    }
}