hideAttrs)->push("hideAttrs")->toArray(); foreach ($this as $key => $val) { if (!in_array($key, $hide) && $val !== null) { $data[$key] = $val; } } return $data; } /*** * 输出JSON * @return \Psr\Http\Message\ResponseInterface */ public function toJson() { $response = new Response(); return $response ->json($this->jsonSerialize()); } /*** * 自动执行 * @return mixed */ public function __toString(): string { // TODO: Implement __toString() method. $response = new Response(); return $response ->json($this->jsonSerialize()) ->__toString(); } }