我有一个包含一些 html 和 php 的网页。php是用来执行一些linux命令的。我想在我的网页中放置一个引导进度条,当执行下一个 Linux 命令时,该进度条会继续前进。
假设我执行了 4 个 Linux 命令,每次执行完一个命令,进度条应该前进 25%。
我在网上搜索过,但找不到任何我需要的东西。有什么建议么?
到目前为止只得到了 php/html 部分:
function progressbarStatus($width) {
echo "
<div class = 'container'>
<div class = 'progress progress-striped active'>
<div class = 'progress-bar' role = 'progressbar' aria-valuenow = '$width' aria-valuemin = '0' aria-valuemax = '100'style = 'width: $width%'></div>
</div>
</div>
</div>
";
}
Run Code Online (Sandbox Code Playgroud) 假设我有一个这样的数组:
var myArray = [
['a', 'b'],
['c', 'd']
]
Run Code Online (Sandbox Code Playgroud)
我如何连接这个二维数组,所以我得到这个结果:
['ab', 'cd']
Run Code Online (Sandbox Code Playgroud) 所以,我在我的 ubuntu 服务器上,想要执行以下命令:
su -c /path/to/command -s /bin/bash -l otheruser
Run Code Online (Sandbox Code Playgroud)
当我在 linux 命令行中键入此命令时,它完美地要求输入其他用户的密码并执行该命令。
但是,当我这样做时
exec("su -c /path/to/command -s /bin/bash -l otheruser");
Run Code Online (Sandbox Code Playgroud)
它什么也不做。我当然还没有为它指定密码,但它并没有真正返回任何可以帮助我解决这个问题的东西。出于测试目的,我已将该命令的权限设置为 777。
有什么建议?