How to design the directory structure of thinkphp5 Restful API version (multi-module)

problem description

A set of interfaces developed by tp5 and a mall for multi-end use are intended to make interface version division. The situation is as follows:

  • API code, PC side and WAP side should be placed under the same tp5 application, because the domain name can only provide one..
  • Interface is multi-module, such as user, order, merchandise, etc.

at present, the directory structure is like this, and it has not been used for API version partition

.
+ application
    + admin   // 
    + wap    // WAP
    + api_users    // 
        + controller
            + Users    // 
            + Accounts    // 
    + api_goods    // 
    + api_orders    // 
    + common    // 
    + ...

is intended to be designed like this, but tp5 does not seem to support it, and the request cannot be found

+ application
    + admin
    + wap
    + v1
        + users
            + controller
                + Users
                + Accounts
        + goods 
    + v2 

under this requirement, how to design the directory structure if you want to add the interface version division?

Apr.15,2021

  • application
    + api

    +controller
       +v1

that's fine. Use Route::get ('api/:ver/user',' api/:ver.User') when routing;


what did you do in the end?

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-1bc9313-30940.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-1bc9313-30940.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?