开发者

Different output with php client and with a browser

Maybe my question is simple, but I'm not able to answer it.

I have this开发者_Python百科 little php code:

<?php

$line="echo 'hello' | lpr -Pmyprinter";
$out=system($line,$output);
?>

When I execute this code using my command line (I use linux with php 5.3.6 and apache 2.2.17) it's printed 'hello' in myprinter.

If I execute this code using my browser it looks like the pipe is ignored!

I have tried with exec(), passthru(), etc. and results are the same.

Thanks for your help.

P.S: I ran previously this code with PHP 5.1.¿¿??


Try using the following:

echo `echo hello | lpr -Pmyprinter`
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜