问题
I'm using YAF Framework and want to make the user's profile link to be user-friendly by using their usernames, if username is abdelhady
so I want the url to be:
www.mysite.com/abdelhady
which of course will route back to something like this:
www.mysite.com/profile/get/username/abdelhady
I've tried something like this, but it didn't work:
$config = array(
"community" => array(
"type" => "rewrite",
"match" => "/:username",
"route" => array(
'controller' => "profile",
'action' => "get",
)
)
);
Yaf_Dispatcher::getInstance()->getRouter()->addConfig(
new Yaf_Config_Simple($config));
It only works if I used a match like this "match" => "/profile/:username",
, but it is not what I want for my project. Do you have any suggestions?
来源:https://stackoverflow.com/questions/18875717/user-friendly-urls-for-user-profiles-in-yaf