diff --git a/lib/zin/zentao/zentao.func.php b/lib/zin/zentao/zentao.func.php index 6e6b4841e6..84c570cc86 100644 --- a/lib/zin/zentao/zentao.func.php +++ b/lib/zin/zentao/zentao.func.php @@ -103,3 +103,17 @@ function bind(string $name, string|array $callback, array $options = null): dire return setData($data); } + +/** + * Render data to json. + * + * @param mixed $data data. + * @param int $flags json encode flags. + * @return void + */ +function renderJson(mixed $data, int $flags = 0) +{ + ob_end_flush(); + zin::$rendered = true; + echo json_encode($data, $flags); +}