开发者

Detect console end of the input in PHP-Cli

Is there any form to detect the end of a console input?

Im using something like this:

<?php
while($consoleInput = fgets(S开发者_运维问答TDIN)) {

 //do something

}
?>

Any sugestions?


How about feof()? Untested, but I believe this will work.

while (!feof(STDIN)) {
  $consoleInput = fgets(STDIN);
}


if (feof(STDIN)) {
   do_something()
};
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜