PHP Classes

File: api/deleteuser-api.php

Recommend this page to a friend!
  Packages of Adeleye Ayodeji   Simple REST API   api/deleteuser-api.php   Download  
File: api/deleteuser-api.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Simple REST API
Example of REST API using the MVC design pattern
Author: By
Last change:
Date: 2 years ago
Size: 498 bytes
 

 

Contents

Class file image Download
<?php

include "../include/autoload.php";
//Json response
header("Content-Type: application/json");
//Get user id
if (isset($_GET["id"])) {
    $id = $_GET["id"];

    //Creating an instance of a class
    $loaddata = new UserController();
    //Delete user data
    $response[] = $loaddata->userDeleteById($id);
    echo json_encode($response);
}else{
        //if id not found
        $error[] = array("message" => "Unique ID is needed");
        echo json_encode($error);
}
?>