dragon8899 2010-04-06 02:59
浏览 34
已采纳

codeigniter - 具有多个表单的页面

I'm new to codeigniter this is my case: I have a homepage with a list of items, I can navigate through pagination, but I have in my sidebar a login form, it's possible to return to the same page after try to login in the case that is valid or not with a validation message. for the login option I have a controller and login function but I don't know what view load after validation. I need to login in any controller and return to the same url. thanks

  • 写回答

1条回答 默认 最新

  • douqiaotong8682 2010-04-06 03:08
    关注

    All your login forms should post to the same Login controller, which can then redirect the user back to the referring URL.

    My personal approach is to remember the last "memorable" page (i.e. worth remembering) the user visited as a session variable. For example, I remember that the user visited the home/contact/products pages, but not the login/signup/404/tos/privacy/etc pages. After a successful login, the Login controller can redirect the user to the last memorable URL.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?