Longhorn PHP 2025 - Call For Papers

Voting

: nine minus seven?
(Example: nine)

The Note You're Voting On

Anonymous
10 years ago
This can be used to handle exceptions properly when using output buffering for rendering a view which may or may not be using output buffering

<?php

function getView($view)
{
$level = ob_get_level();

ob_start();

try
{
include
$view;
}

catch (
Exception $e)
{
while (
ob_get_level() > $level)
{
ob_end_clean();
}

throw
$e;
}

return
ob_get_clean();
}

<< Back to user notes page

To Top