Manage URL routes in own php framework

前端 未结 12 2134
盖世英雄少女心
盖世英雄少女心 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:10

    If I am understanding what you are after correctly, then one solution may be to carry on doing what you are doing, but also get the path of the main routing script (using realpath() for example).

    If the last folder (or folder before that etc) matches the beginning URL item (or another section), you ignore it and go for the next one.

    Just my 2 cents :-).

提交回复
热议问题