getTask(); if(!$params){ echo('暂无任务'); } try { exec($params['params'], $resArr, $status); $result = json_encode($resArr,JSON_UNESCAPED_UNICODE); D("CmdTasks")->updateTask(['id'=>$params['id'],'status' => 2, 'end_time' => time(), 'result' => $result]); } catch (Exception $e) { D("CmdTasks")->updateTask(['id'=>$params['id'],'status' => 3, 'end_time' => time(), 'result' => $e->getMessage()]); } } }