Manage URL routes in own php framework

前端 未结 12 2157
盖世英雄少女心
盖世英雄少女心 2021-02-02 16:34

I\'m creating a PHP Framework and I have some doubts...

The framework takes the url in this way: http:/web.com/site/index

It takes the first paramet

12条回答
  •  暖寄归人
    2021-02-02 17:07

    basically grab the url string after your first slash, and then explode it into an array (i use '/' as a delimiter).

    then carefully array_shift off your elements and store them as variables

    item 0: controller
    item 1: the action / method in that controller
    item 2 thru n: the remaining array is your params
    

提交回复
热议问题