1
我目前正在研究一个项目,在这个项目中我需要这个来操纵参数以达到审美目的。使用正则表达式在URL中进行匹配
add_rewrite_rule('([^/]*)/user/([^/]+)','index.php?pagename=$matches[1]&username=$matches[2]', 'top');
-> would correctly retrieve the userID (in this case 232) from the following URL: http://mysite.com/userlisting/user/232
add_rewrite_rule('([^/]*)/([^/]*)/user/([^/]+)','index.php?pagename=$matches[1]&username=$matches[2]', 'top');
-> would correctly retrieve the userID (in this case 232) from the following URL: http://mysite.com/parent_directory/userlisting/user/232
现在我可以补充,让我们说的这些规则10,以确保我获得至少10个级别层次进行,但我希望做的是让它有些动态的基础上,多少级目前的“用户名单”已经。
任何帮助将不胜感激。
谢谢!它像一个魅力一样工作! – 2013-03-26 14:55:26