PHP
·
发表于 5年以前
·
阅读量:8299
<?php
/**
*/
class outbuffer {
var $length;
var $buffer;
function outbuffer($proc="") {
$this->run($proc);
}
function run($proc="") {
ob_start();
include($proc);
$this->length = ob_get_length();
$this->buffer = ob_get_contents();
$this->buffer = eregi_replace("\r?\n","\r\n",$this->buffer);
ob_end_clean();
}
function display() {
echo $this->buffer;
}
function savetofile($filename="") {
if($filename == "") return;
$fp = fopen($filename,"w");
fwrite($fp,$this->buffer);
fclose($fp);
}
function loadfromfile($filename="") {
if($filename == "") return;
$fp = fopen($filename,"w");
$this->buffer = fread($fp,filesize($filename));
fclose($fp);
}
}
?>