-
-
Save parzibyte/87a5e9315791592b9fff22137cf63c0a to your computer and use it in GitHub Desktop.
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 | |
$cargaUtil = json_decode(file_get_contents("php://input")); | |
// Si no hay datos, salir inmediatamente indicando un error 500 | |
if (!$cargaUtil) { | |
// https://parzibyte.me/blog/2021/01/17/php-enviar-codigo-error-500/ | |
http_response_code(500); | |
exit; | |
} | |
// Extraer valores | |
$nombre = $cargaUtil->nombre; | |
$precio = $cargaUtil->precio; | |
$descripcion = $cargaUtil->descripcion; | |
include_once "funciones.php"; | |
$respuesta = guardarProducto($nombre, $precio, $descripcion); | |
// Devolver al cliente la respuesta de la función | |
echo json_encode($respuesta); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment