fprint doens't work in my php
题
I want to write some text from script in browser.
<?php
$out = fopen('php://stdout', 'w');
fprintf($out, "Hello!");
fclose($out);
?>
I expect "Hello!" on output, but nothing happens...Could it be bug in stdout, or I just oversighted something?
解决方案
This would be true if calling php from console.
But if you are talking about web access, you should use php://output
其他提示
Have you tried the simple :
<?php
$out = "foobar";
echo $out;
?>
?
By default, php print on STDOUT
.
不隶属于 StackOverflow