Variables in shell_exec() script

2019-08-03 07:39发布

Is there any possible way to make this simple script function properly?

<?php
$hi = "echo hi";
shell_exec($hi);
echo "<pre>$output</pre>";
?>

please help me out?

2条回答
太酷不给撩
2楼-- · 2019-08-03 07:53
$hi = "echo hi";
# the result needs to be assigned to $output before using it
$output = shell_exec($hi);
echo "<pre>$output</pre>";
查看更多
对你真心纯属浪费
3楼-- · 2019-08-03 08:02

Sure just assign the variable.

<?php
$hi = "echo hi";
$output = shell_exec($hi);
echo "<pre>$output</pre>";
?>
查看更多
登录 后发表回答