dsizmmwnm56437180 2010-03-04 21:50
浏览 62
已采纳

覆盖默认路由,但必要时调用它

I'm developing a site which has urls like this:

site.com/james
site.com/james/photos

Schema for this urls are this: site.com/USERNAME/APPLICATION

Both username and application names are checking from db yb program logic. I set the route for this but Zend is routing all requests to this route.

But there is same controllers and admin module. When i go to site.com/admin, it looks for username "admin". Or when i go to site.com/james/profile, it tries to find the application named "profile". But there is a action in UserController for this.

How can i implement this feature? For example a front controller which looks for names of Controllers and dispatch the requst to them if controller exists?

  • 写回答

3条回答 默认 最新

  • dongxing1412 2010-03-05 00:01
    关注

    Have a look at overriding the Zend_Controller_Action __call($method, $args) method which is invoked if the desired action cannot be found. You could put your site.com/USERNAME/APPLICATION checking logic in the __call method of, say, the default controller (or wherever makes most sense) and go back to using the default route.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离