PHP:生成Laravel分页器安全(HTTPS)链接 [英] PHP: Generate Laravel Paginator Secure (HTTPS) Links

查看:111
本文介绍了PHP:生成Laravel分页器安全(HTTPS)链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用基于安全路由和重定向的HTTPS上的Laravel 4.2开发一个应用程序.我正在使用Paginator对结果进行分页,但是视图中呈现的链接指向http页面,我们如何强制Paginator生成https链接?

I'm developing an app using Laravel 4.2 over HTTPS with secure routes and redirects. I'm using Paginator to paginate results, but the links rendered in the view points to the http pages, how can we force Paginator to generate https links?

推荐答案

我今天遇到了这个问题,并找到了这个全局解决方案.

I had this issue today and found this global solution.

在您的AppServiceProvider :: boot方法中,您可以添加以下内容以在分页链接上强制使用https

In your AppServiceProvider::boot method you can add the following to force https on pagination links

$this->app['request']->server->set('HTTPS','on');

这篇关于PHP:生成Laravel分页器安全(HTTPS)链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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