首页 >社区问答列表 >tp5框架询问

tp5框架询问

public function doEdit(Request $request)
    {
    
     $data = $request ->except('shebei');
  $condition = ['id'=>$data['id']];
        $result = GongyikaModel::update($data,$condition);
        $status = 0;
        $message = '更新失败,请检查';
     if (true == $result) {
            $status = 1;
            $message = '恭喜, 更新成功~~';
        }
        return ['status'=>$status, 'message'=>$message];
    }

请问老师$data['id']这个ID运行时候咋获取不到是空的

  1. return $this->view->fetch('gongyikabianji');
  2.    }
  3.    
  4.    public function doEdit(Request $request)
  5.    {
  6.    
  7.    $data = $request ->except('shebei');
  8. $condition = ['id'=>$data['id']];
  9.        $result = GongyikaModel::update($data,$condition);
  10.        $status = 0;
  11.        $message = '更新失败,请检查';
  12.    if (true == $result) {
  13.            $status = 1;
  14.            $message = '恭喜, 更新成功~~';
  15.        }
  16.        return ['status'=>$status, 'message'=>$message];
  17.    }

调用堆栈

  1. Gongyika.php第104行
  2. Error :: appError(8,'Undefined index:id',' E:\ myphp_www \ PHPTuto ... ',104,['request'=> objectRequest),'data'=> []])中Gongyika.php第104行