【问题标题】:Laravel 5.6 Redirect and Header not redirecting from inside controllerLaravel 5.6 Redirect 和 Header 未从控制器内部重定向
【发布时间】:2018-10-04 17:29:12
【问题描述】:

我正在尝试重定向到我的 Laravel 控制器中的外部 URL,但它没有重定向到另一个页面。

我也尝试过使用 header 无济于事。

Redirect to external URL with return in laravel

Laravel 5: redirect to an external link outside of localhost/server

这是我在网络控制台日志中的响应标头。我在那里看到了外部 URL,但它没有被重定向到。

alt-svc: clear
date: Thu, 04 Oct 2018 17:18:51 GMT
status: 200
strict-transport-security: max-age=31556926; includeSubDomains; preload
via: 1.1 google
x-content-type-options: nosniff
x-xss-protection: 1; mode=block

控制器中的私有函数是用于重定向的函数。

private function processRedirect($gohere){
        return Redirect::away($gohere);
    }
}

【问题讨论】:

    标签: php laravel redirect laravel-5


    【解决方案1】:

    确保$gohere 包含完整的 URL,如下所示:

    $gohere = "https://stackoverflow.com";
    
    private function processRedirect($gohere){
            return Redirect::away($gohere);
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2017-05-03
      • 2011-11-23
      • 1970-01-01
      • 1970-01-01
      • 2023-04-10
      • 1970-01-01
      • 1970-01-01
      • 2013-11-30
      • 1970-01-01
      相关资源
      最近更新 更多