Laravel 中的位置标头 [英] Location headers in Laravel

查看:25
本文介绍了Laravel 中的位置标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我大学的身份验证系统 (Ucam_Webauth) 使用图书馆,这意味着我必须通过其中一种方法重定向到身份验证服务器.不幸的是,由于该库的体系结构,我无法返回 Redirect:to().该库本身使用 header('Location: ...'); 但这由于某种原因不起作用.

I'm working with a Library for my university's authentication system (Ucam_Webauth) which means I have to redirect to the authentication server in one of the methods. Unfortunately, I cannot return a Redirect:to() because of the architecture of this library. The library itself uses header('Location: ...'); but this isn't working for some reason.

如果我在发送标头后使程序 die(); 可以工作,否则就不行.

If I make the programme die(); after sending the header it works, but otherwise it doesn't.

知道如何解决这个问题吗?

Any idea how I can fix this?

推荐答案

return redirect()->to('url')->send();

发送 HTTP 标头和内容.在我的应用程序中,send() 方法的作用类似于 'exit()' 并且是可测试的

Sends HTTP headers and content. In my application, send() method acts like 'exit()' and is testable

这篇关于Laravel 中的位置标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆