Laravel 在 RedirectResponse 中访问 url

Laravel access url in RedirectResponse

我使用的支付包 return 是 RedirecResponse class 的一个实例,然后用户被重定向到支付页面。

我需要在移动应用程序中使用它。我不知道如何告诉应用程序打开那个付费页面。我不能 return RedirecResponse 实例到应用程序,因此我必须从 RedirecResponse 实例中获取支付页面的 url 然后 return 它到应用程序,然后应用程序必须打开浏览器。

TargetUrl 属性 包含 url 但 Laravel return 访问此文件时出现以下错误:

Cannot access protected property Illuminate\Http\RedirectResponse::$targetUrl

如何从 RedirectResponse 获取 url?

谢谢

您可以添加 $redirectResponse->getTargetUrl() 这样的内容以获得重定向响应。

已确认:

$redirectResponse->getTargetUrl()

成功了