【发布时间】:2010-11-24 06:51:01
【问题描述】:
我正在使用命令行 PHP 离线构建一些文件。为了捕获脚本输出,我使用标准的 ob_start 东西:
ob_start();
// Echo lots of stuff
$content = ob_get_contents();
// Now the $content can be written to a file
但是,我还想在将“主要输出”收集到缓冲区中的同时向终端打印一些消息(例如,警告)。有没有办法做到这一点?似乎不可能暂停缓冲一段时间以打印终端消息,然后从它离开的地方继续缓冲。有什么解决方法吗?
【问题讨论】:
标签: php command-line