Error in how the slim framework customizes the request method

for example, the POST request interface is specified, but a request from GET will report an error as shown in the following figure

so how do you customize the returned errors? For example,
{"error": "Method not allowed"}

is returned.
Mar.01,2021

// notAllowedHandler
$container['notAllowedHandler'] = function ()
{
    return function ($req, $res, $allowMethod) {
        return $res->withJson([
            "status" => 0,
            "info" => "",
            "data" => $allowMethod
        ]);
    };
};
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b33a18-2beb4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b33a18-2beb4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?