在
PHP中为STDOUT写入大块时,您可以这样做:
echo <<<END_OF_STUFF lots and lots of text over multiple lines etc.etc END_OF_STUFF;
(即heredoc)
我需要做一个类似的事情,但对STDERR.还有另一个命令,如echo,而是使用STDERR?
是的,使用PHP:// stream wrapper:
http://php.net/manual/en/wrappers.php.php
原文链接:https://www.f2er.com/php/131764.html$stuff = <<<END_OF_STUFF lots and lots of text over multiple lines etc.etc END_OF_STUFF; $fh = fopen('PHP://stderr','a'); //both (a)ppending,and (w)riting will work fwrite($fh,$stuff); fclose($fh);