我正在做一些关于从
PHP最小化html的研究.喜欢
class themeing
{
function render( $file, $folder )
{
if ( COMPRESS ) {
// this is the problem
ob_start('compressor');
}
$get = VIEWS . $folder . '/' . $file . '.phtml';
if ( COMPRESS ) {
ob_end_flush();
}
return $get;
}
function compressor($buffer)
{
$search = array(
'//',
'/\>[^\S ]+/s',
'/[^\S ]+\
'/(\s)+/s'
);
$replace = array(
'',
'>',
'
'\\1'
);
$buffer = preg_replace($search, $replace, $buffer);
return $buffer;
}
}
问题是如何调用这个ob_start(函数)?我们可以像ob_start($this-> compresssor())那样做吗? (好吧,我知道它失败了)在课堂上?任何人 ??
谢谢你的关注.
亚当拉马丹