Created
January 20, 2017 14:04
-
-
Save donpandix/99f9232a07a2d2f0ed2a14cbec6f9b68 to your computer and use it in GitHub Desktop.
Cabecera PHP para retorno de objetos JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Array con los valores que quiero retornar | |
$arrJson = array('clave' => 'valor'); | |
// Cabecera para que su contenido sea considerado como un objeto JSON | |
header('Content-Type: application/json'); | |
// Retorno del array serializado como JSON | |
echo json_encode( $arrJson ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment