I want to get parameter from url api. http://localhost:8080/api/dangnhap.php/danhsach?id=123
Error: Notice: Undefined index: id in C:\xampp\htdocs\api\dangnhap.php on line 15.
Thank.
My resful code
private function _input(){
    // code của hàm _input
    $this->params = explode('/', trim($_SERVER['PATH_INFO'],'/'));
    $this->endpoint = array_shift($this->params);
    $method         = $_SERVER['REQUEST_METHOD'];
    $allow_method   = array('GET', 'POST', 'PUT', 'DELETE');
    if (in_array($method, $allow_method)){
        $this->method = $method;
    }
    // Nhận thêm dữ liệu tương ứng theo từng loại method
    switch ($this->method) {
        case 'POST':
             $this->params = $_POST;    
        break;
        case 'GET':
            // Không cần nhận, bởi params đã được lấy từ url
        break;
        case 'PUT':
            $this->file    = file_get_contents("php://input");
        break;
        case 'DELETE':
            // Không cần nhận, bởi params đã được lấy từ url
        break;
        default:
            $this->response(500, "Invalid Method");
        break;
    }
}
<?php
My DangNhap.php code
class dangnhap extends restful_api {
function __construct(){
    parent::__construct();
}
function danhsach(){
    if ($this->method == 'POST'){
        
        echo($_POST['id']);
    }
}
 
    