doudao7511 2014-01-02 09:17
浏览 85
已采纳

Laravel路由组后,浏览器无法加载页面

I've just added Route groups to my route file in Laravel and now when I attempt to load my website, I get a message that says "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

I'm not sure why this is, can anyone see any errors in my routes file?

code redacted

One thing I tried that seemed to work but didn't make sense was returning each of the Route::get() calls inside of these. Is there something I'm doing wrong?

edit: When I edit the root route in the After Authentication Routes commented area to route to the StaticController@getIndex method, it works. Am I using the group filter incorrectly?

  • 写回答

1条回答 默认 最新

  • dongtuo4723 2014-01-02 09:34
    关注

    I've solved this.

    After taking a look at what the auth filter actually is...

    Route::filter('auth', function() {
        if (Auth::guest()) return Redirect::guest('login');
    });
    

    I realized that I was using it wrong.

    If anyone else runs into this problem, the auth filter checks if a user is logged in, and if not, it redirects them to a login page (my problem was I was trying to access the login page while not logged in, causing an infinite loop.)

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

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看