请教这段代码是什么意思呢?能否详解?PHP

来源:百度知道 编辑:UC知道 时间:2024/06/30 11:04:25
class word
{

function start()
{
ob_start();
}

function save($path)
{
$data = ob_get_contents();
ob_end_clean();
$this->wirtetoword($path,$data);
}
function wirtetoword ($fn,$data)
{
$fp=fopen($fn,"wb");
fwrite($fp,$data);
fclose($fp);
}
}

具体的代码写法你应该都知道,估计你可能是想问ob_start(),ob_get_contents(),ob_end_clean()这几个函数的用途。

我查了一下资料,大致应该是如下意思:
ob_start
(PHP 4, PHP 5)

ob_start — Turn on output buffering
也就是输出缓冲开始。

ob_get_contents
(PHP 4, PHP 5)

ob_get_contents — Return the contents of the output buffer
就是得到缓冲输出的内容。

ob_end_clean
(PHP 4, PHP 5)

ob_end_clean — Clean (erase) the output buffer and turn off output buffering
清空输出缓冲并关闭之。

fopen,fwrite,fclose你应该都知道了是操作文件的。