开发者

php header and shell_exec

开发者 https://www.devze.com 2023-03-31 21:27 出处:网络
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:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消