开发者

zend custom router that uses a mysql db

I am looking at writing a application that requires search engine friendly URLs for a lot of pages. So for example to access say site.com/blah could be a user or a page. For this I was thinking of having a table where I have the URL and then I have a column with the controller, action and any parameters su开发者_如何学Pythonch as id of a page or a user.

I know a db look-up can be slow so I am wondering if this is the best way of going about things?


If you have to use the same route URL (site.com/blah) for two different controller/action, the only way is to use database lookup. When a new user signs up, store the username and the user ID in the database and the route type to 'User' for this username. When a new page is created, store the page name and the page ID in the database and the route type to 'Page'. When a URL is requested, check the name against the database and get the route type and forward accordingly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜