Manage URL routes in own php framework

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

    Within the application configuration script place a variable which will be set to the path the application runs at.

    An alternative is to dynamically set that path.

    Before the part

    $url = explode('/',preg_replace('/^(\/)/','',$url));
    

    strip the location (sub-folder) path out of the $url string using the predefined application path.

提交回复
热议问题