1

我正在使用YAF 框架,并希望通过使用用户名使用户的个人资料链接对用户友好,如果用户名是abdelhady这样,我希望 url 为:

www.mysite.com/abdelhady

这当然会回到这样的事情:

www.mysite.com/profile/get/username/abdelhady

我尝试过这样的事情,但没有奏效:

    $config = array(
        "community" => array(
            "type" => "rewrite",
            "match" => "/:username",
            "route" => array(
                'controller' => "profile",
                'action' => "get",
            )
        )
    );
    Yaf_Dispatcher::getInstance()->getRouter()->addConfig(
            new Yaf_Config_Simple($config));

它只有在我使用这样的匹配时才有效"match" => "/profile/:username",,但这不是我想要的项目。你有什么建议吗?

4

0 回答 0