: This article mainly introduces considerations for calling shell commands in PHP. For more information about PHP tutorials, see. Notes for calling shell commands in PHP. For more information, see.
Escapeshellarg (string $ arg)
Php security can be used to filter out some special characters in arg. In the input parameter, if
If it contains Chinese characters and is passed to escapeshellarg, it will be filtered out.
Escapeshellcmd (string $ command)
The escapeshellcmd () function will escape all shell metacharacters in the command to complete the work. These metacharacters
Including: # &; ', | *? ~ <> ^ () [] {}$ \\.
Exec (string $ command [, array & $ output [, int & $ return_var])
Execute the defined command. If the array output is defined, the output result is uploaded to the output,
The returned values of execution results are stored in return_var.
Passthru (string $ command [, int & $ return_var])
Similar to exec and system, the returned value is raw data, such as binary data.
Shell_exec (string $ cmd)
Run the command cmd in shell to return the complete string.
System (string $ command [, int & $ return_var])
Returns the value after the command is executed. If php runs in server mode, the system attempts to automatically refresh
The output cache of the web server.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above describes the precautions for calling shell commands in PHP, including some content. I hope to help some friends who are interested in PHP tutorials.