后端目录打开 vendor\laravel\framework\src\Illuminate\Http\JsonResponse.php 文件 文件内搜索 setData 方法,将下方的替换进去 public function setData($data = []) { $this->original = $data; if ($data instanceof Jsonable) { $this->data = $data->toJson($this->encodingOptions); } elseif ($data instanceof JsonSerializable) { $this->data = json_encode($data->jsonSerialize(), $this->encodingOptions); } elseif ($data instanceof Arrayable) { $this->data = json_encode($data->toArray(), $this->encodingOptions); } else { $this->data = json_encode($data, $this->encodingOptions); } if (! $this->hasValidJson(json_last_error())) { throw new InvalidArgumentException(json_last_error_msg()); } return $this->update(); }