【发布时间】:2011-06-25 09:07:49
【问题描述】:
基本上,我希望从 STDIN 读取行,但我不想在等待新数据时阻塞。几乎就像使用带有超时的流一样。
$stdin = fopen('php://stdin', 'r');
do {
$line = fgets($stdin);
// No input right now
if (empty($line)) {
// Do something before waiting for more input
}
} while (1);
【问题讨论】: