Laravel包括CSS,使用ssl的js [英] Laravel include css, js using ssl

查看:135
本文介绍了Laravel包括CSS,使用ssl的js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在Web服务器上安装了SSL证书,但是laravel设置存在一些问题.

I just installed an SSL cert onto my web server and I'm having some issues with my laravel setup.

我正在使用

{{ HTML::style('css/style.css') }}

包括CSS和js

{{ HTML::script('js/jquery.js') }}

尽管当我使用https加载页面时,它似乎包含2而不是https.

Though when I load the page with https it seems to include the 2 with http instead of https.

知道为什么吗?

推荐答案

我对此也有疑问.我的SSL重定向很好,但是{{ HTML::style('css/style.css') }}HTML::script('js/script.js')生成的CSS和JS链接已链接到http版本.

I had an issue with this too. My SSL is redirecting fine, but the CSS and JS links generated by {{ HTML::style('css/style.css') }} and HTML::script('js/script.js') were linking to the http versions.

如果您查看 Illuminate \ Html \ HtmlBuilder文档您会看到可以指定安全版本,如下所示:

If you look at the Illuminate\Html\HtmlBuilder Documentation you'll see that you can specify the secure version as follows:

{{ HTML::style('css/style.css', array(), true) }}

{{ HTML::script('js/script.js', array(), true) }}

true表示$secure标志处于打开状态.

true means $secure flag is on.

这篇关于Laravel包括CSS,使用ssl的js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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