Skip to content

Instantly share code, notes, and snippets.

@govaniso
Created February 29, 2020 00:09
Show Gist options
  • Save govaniso/58e1d5bdb52cf349063572f376d73854 to your computer and use it in GitHub Desktop.
Save govaniso/58e1d5bdb52cf349063572f376d73854 to your computer and use it in GitHub Desktop.
<?php
// core/kumbia/kumbia_view.php
/**
* Devuelve la respuesta en formato JSON
* application/json
*
* @param type $data
*/
public static function json($data)
{
View::select(null, null);
header('Content-type: application/json');
echo json_encode($data);
}
// core/libs/input/input.php
/**
* Permite recuperar los datos en formato json
* @return json
*/
public static function json()
{
$json = file_get_contents('php://input');
return json_decode($json, true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment