PHP provides a large number of functions for executing external commands, including shell_exec (), exec (), passthru (), and system (). These commands are similar, but provide different interfaces for the external programs you run. All these
All of these commands derive a subprocess to run the command or script that you specify, and each subprocess catches them when the command output is written to standard output (stdout).
shell_exec ()
The shell_exec () command line is actually only
All of these commands derive a subprocess that runs the commands or scripts that you specify, and each child process captures them when the command output is written to standard output (stdout).
shell_exec ()
The shell_exec () command line is
PHP executes the system's external command system () exec () passthru (). Difference: system () outputs and returns the last shell result. Exec () does not output results. The last shell result is returned. all results can be saved to a returned
[Switch] PHP executes system external commands system () exec () passthru () and execpassthru. [Switch] PHP executes the system external command system () exec () passthru (), execpassthru myself Note: You must pay attention to security issues. I
The usage and security of PHP exec system passthru system functions and other application functions are described in detail. If you need them, refer to them.
Differences:System () Outputs and returns the last shell result.Exec () does not output
As a server-side scripting language, PHP is fully competent for tasks such as simple writing or complex dynamic web pages. But this is not always the case. sometimes, to implement a function, you must use an external program (or a command) of the
A detailed introduction to the PHP exec System passthru systems function usage and security and other application features, a friend of the need to refer to.
Difference:System () outputs and returns the last line of the shell results.EXEC () does
"Go" PHP Execution System external Command systems () EXEC () PassThru (), Execpassthru
I note: Use must pay attention to security issues, in the following I will enumerate some of the relevant PHP code audit. The contents are reproduced below.
PHP
Differences:System () Outputs and returns the last shell result.Exec () does not output results. The last shell result is returned. All results can be saved to a returned array.Passthru () only calls the command and directly outputs the command
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.