开发者

Different output with php client and with a browser

开发者 https://www.devze.com 2023-03-01 04:58 出处:网络
Maybe my question is simple, but I\'m not able to answer it. I have this开发者_Python百科 little php code:

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

精彩评论

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