PHP而shell_exec杀了-9

时间:2014-05-16 15:40:21

标签: php ubuntu while-loop

我曾经再次问过,我看到一些我不会使用while循环来杀死进程,不幸的是,在apache日志中听到了错误消息?

    sh: line 0: kill: 27185
: arguments must be process or job IDs

这不确定,我知道我只想了解一些事情:)希望能帮到

PHP代码:

$box=$_POST['delete'];
while (list ($key,$val) = @each ($box)) {
    $exe="kill -9 $val";
    shell_exec($exe);

}

问候

1 个答案:

答案 0 :(得分:0)

$box=$_POST['delete'];
while (list ($key,$val) = @each ($box)) {
    if (!empty($val) && is_numeric($val)) { // $val is not 0 or an empty string, and is a number.
        $exe="kill -9 $val";
        shell_exec($exe);
    }
}