PHP: the difference between exec and system is that external commands can be called in PHP. exec and system can be used for implementation:
System ()
Prototype: string system (string command [, int return_var])
The system () function is similar to the one in other languages. it executes the given command, outputs and returns the result. The second parameter is optional and is used to obtain the status code after the command is executed.
Returned results
0 is returned for success,
Failed (the command does not exist, and other reasons). a non-0 value is returned.
Exec ()
Prototype: string exec (string command [, string array [, int return_var])
The exec () function is similar to system (). It also executes the given command, but does not output the result, but returns the last line of the result. Although it only returns the last line of the command result, the complete result can be obtained using the second parameter array by appending the result row by row to the end of the array. Therefore, if the array is not empty, we recommend that you use unset () to clear it before calling it. Only when the second parameter is specified can the third parameter be used to obtain the command execution status code.
Example:
Exec ("/bin/ls-l ");
Exec ("/bin/ls-l", $ res );
Exec ("/bin/ls-l", $ res, $ rc );