I have a couple of questions about a php script I'm looking at,
it has a bunch of code that I'm trying to figure out what it does:
the main portio开发者_如何学Cns are:
echo shell_exec("bash '".$shell_script_to_execute."' '".$jobtype."' '".
$REMOTE_USER."' '".$clientname."' '".$jobcommand."' '".$jobid."' '".
$servername."' '".$rootaccess."' ");
header("Location: https://192.168.42.78/operator/{$php_script_to_execute}?time=$time&jobname=$jobname&clientname=$clientname&groupname=$groupname");
What exactly does shell_exec function do? and the header function? Is header just a redirect? What if I have echo statements before that, will it redirect to the header page first and then display the echos?
Thanks
The shell_exec()
function executes a shell command and returns the command's output.
The header()
function sets a HTTP header. The specific Location
header causes the browser to redirect to the given URL. You should not output anything before using the header() function (or PHP won't be able to send the header).
I don't know if you're familiar with php.net, but these kind of questions you shouldn't ask here. Simply refer to the manual on http://php.net/docs.php
shell_exec
header
精彩评论