The route is defined as a `post` in Thinkphp5. How to customize the error when using `get` request

Thinkphp5 defines the route as a post , and how to customize the error when using get request

if a post route is defined in application/route.php in thinkphp5, as follows, how to customize the wrong content and return the wrong json when we request in the wrong way.

Route::group("user", function (){
   Route::post("/login", "api/User/login");
});

normal access, use post request. The result returned above is:

{
    "code": 10001,
    "msg": "",
    "request_url": "/index.php/user/login"
}

ask which Daniel to have a look!

Apr.30,2021

Route::miss(function () {
    return json(['code' => 999, 'msg' => '']);
});
  • Thinkphp route matching problem

    Route::post( xdk plan , xdk plan save ); Route::post( xdk plan :id fav , xdk plan fav ); Route::post( xdk plan :id comments , xdk plan comments ); is to build a restful style api xdk plan post xdk plan :id fav like xdk plan :id c...

    Mar.12,2021
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-1eac2a8-20b1.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-1eac2a8-20b1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?