Rewriting URLs in PHP instead of server config

前端 未结 3 1508
南旧
南旧 2021-01-28 23:35

I\'m looking for a very lightweight routing framework (to go with php-skel).

The first thing I\'d like to investigate is specifying rewrite rules in a php file (\"not fo

3条回答
  •  后悔当初
    2021-01-29 00:06

    The php way:

    http://example.com/index.php/controller/action/variables

    $routing = explode("/" ,$_SERVER['PATH_INFO']);
    $controller = $routing[1];
    $action = $routing[2];
    $variables = $routing[3];
    

提交回复
热议问题