位置标题在Laravel [英] Location headers in Laravel

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

问题描述

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



如果我在发送头文件后使程序 die(); 成功,否则它不会。



任何想法如何解决这个问题?

解决方案

我不知道我关注。 Laravel将Location标头设置为Redirect :: to()方法的一部分。如果你想更明确地定义响应,你可以这样做。

  return Response :: make('',302 ) - >标题('Location',$ url); 

如果这不起作用,我可能会回头看看php stdlib header()和返回null。



如果所有这些仍然没有任何好处,也许剖析器会搞砸。如果它已打开,请尝试在配置中禁用它。

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.

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

Any idea how I can fix this?

解决方案

I'm not sure I follow. Laravel sets the Location header as part of the Redirect::to() method. If you want to more explicitly define the response you could do it like this.

return Response::make( '', 302 )->header( 'Location', $url );

If that doesn't work I'd probably just fall back on the php stdlib header() and return null.

If all of this still doesn't do any good, maybe the profiler is messing things up. If it is turned on, try disabling it in the config.

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

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