1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
<?php
namespace hji\common\utils;
class View
{
public static function render($fileName, $vars = false)
{
$response = false;
if (file_exists($fileName))
{
ob_start();
$vars = apply_filters('hji_view_vars_' . basename($fileName), $vars);
if (!empty($vars))
{
extract($vars);
}
require($fileName);
$response = ob_get_contents();
ob_end_clean();
}
return $response;
}
}