PHP Application URL Routing

后端 未结 8 1941
梦毁少年i
梦毁少年i 2020-11-29 00:15

So I\'m writing a framework on which I want to base a few apps that I\'m working on (the framework is there so I have an environment to work with, and a system that will let

8条回答
  •  旧时难觅i
    2020-11-29 00:29

    You should check out Pux https://github.com/c9s/Pux

    Here is the synopsis

    any('/product', ['ProductController','listAction']);
    $mux->get('/product/:id', ['ProductController','itemAction'] , [
        'require' => [ 'id' => '\d+', ],
        'default' => [ 'id' => '1', ]
    ]);
    $mux->post('/product/:id', ['ProductController','updateAction'] , [
        'require' => [ 'id' => '\d+', ],
        'default' => [ 'id' => '1', ]
    ]);
    $mux->delete('/product/:id', ['ProductController','deleteAction'] , [
        'require' => [ 'id' => '\d+', ],
        'default' => [ 'id' => '1', ]
    ]);
    $route = $mux->dispatch('/product/1');
    Executor::execute($route);
    

提交回复
热议问题