We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Router Phalcon

Hi everyone,

I have a question I could not find anywhere, and I ask your help.

Well, I need the first parameter of the URI is "ignored" and save it in a session, as this first parameter is the user's system.

Examples

www.system.com/enterprise1/xxxxx

www.system.com/enterprise2/xxxxx

www.system.com/enterprise3/xxxxx

Thanks !



43.9k
Accepted
answer

Hi,

I've not tested it, but this is how would code it:

$router->add(
    "/([a-zA-Z0-9_-]+)/:controller/:action/:params",
    array(
        "controller" =>2,
        "action"     => 3,
        "params"     => 4,
    )
);

Thanks man !

It was exactly what I wanted.