$value) { $rs[$key] = self::encode($value); } return $rs; } return htmlspecialchars($data, ENT_QUOTES, 'UTF-8'); } /** * Encodes the data as a JSON string with HTML entities escaped. * * @static * * @param array $data * * @return string */ public static function serialize(array $data) { return self::encode(json_encode($data)); } }