douwei1930 2014-05-16 15:40
浏览 139
已采纳

PHP而shell_exec杀了-9

I have once asked again, I see something I will not use a while loop to go through to kill processes, unfortunately, the error message is heard in the apache log?

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

That this is not sure, I'm aware I just want to understand something :) hope to help

PHP Code:

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

}

greeting

  • 写回答

1条回答 默认 最新

  • doulei6778 2014-05-16 16:01
    关注
    $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);
        }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 outlook无法配置成功
  • ¥15 Pwm双极模式H桥驱动控制电机
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换