使用delete和put请求时报错 
                            
                                                    
                        
                    
                    
  
                    
                    使用资源路由的delete请求时报错
路由:Route::resource(‘notice’, NoticeController::class);
用delete请求访问访问:xxx.xxx.xxx.xxx/notice/1
控制器代码:
public function destory(string $id)
{
    try {
        $this->notice->delete($id);
        return json_encode(['message'=>"公告删除成功",'data'=>[],'code'=>200]);
    } catch (Exception $e) {
        return json_encode(['message'=>$e->getMessage(),'data'=>[],'code'=>$e->getCode()]);
    }
}
报错:TypeError: Illuminate\Session\Middleware\StartSession::addCookieToResponse(): Argument #1 ($response) must be of type Symfony\Component\HttpFoundation\Response, null given, called in /www/wwwroot/test/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php on line 125 in file /www/wwwroot/test/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php on line 218
使用put请求时也会报一样的错,get和post可以正常使用,望各位大佬指点QAQ。
          
                    
                    
          
          
                关于 LearnKu
              
                    
                    
                    
 
推荐文章: