The CLI SAPI defines a few constants for I/O streams to make programming for the command line a bit easier.
常量名称 | 描述 |
---|---|
STDIN |
An already opened stream to
<?php stdin , you can
use
<?php |
STDOUT |
An already opened stream to
<?php |
STDERR |
An already opened stream to
<?php |
有了以上常量,就无需自己建立指向诸如 stderr
的流,只需简单的使用这些常量来代替流指向:
php -r 'fwrite(STDERR, "stderr\n");'
注意:
These constants are not available if reading the PHP script from
stdin
.