PHP中的exec(),shell_exec,system()和passthru()函数有什么区别? [英] What is different between exec(), shell_exec, system() and passthru() functions in PHP?
本文介绍了PHP中的exec(),shell_exec,system()和passthru()函数有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人请告诉我.我想知道exec()
,shell_exec
,system()
和passthru()
函数之间的区别吗?
Anybody please tell me. I want know the different between the exec()
, shell_exec
, system()
and passthru()
function?
我从 php.net 搜索无法获得我需要的答案.
I search from php.net unable to get the answers I need.
推荐答案
-
exec
仅返回生成的输出的最后一行.
当命令完成运行时, -
shell_exec
返回命令的完整输出. -
system
立即显示所有输出,并用于显示文本. -
passthru
也立即返回输出,但用于二进制数据.passthru
显示原始数据. exec
only returns the last line of the generated output.shell_exec
returns the full output of the command, when the command finished running.system
immediately shows all output, and is used to show text.passthru
also returns output immediately, but is used for binary data.passthru
displays raw data.
使用exec
和shell_exec
都可以自己处理输出,而system
和passthru
不允许您自定义它并立即显示输出.
With both exec
and shell_exec
it is possible to handle the output yourself, while system
and passthru
won't let you customize it and immediately display the output.
在此处中可以找到更详细的比较.
A more detailed comparison can be found here.
这篇关于PHP中的exec(),shell_exec,system()和passthru()函数有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文