Php 在laravel中动态确定http/https

Php 在laravel中动态确定http/https,php,html,laravel,Php,Html,Laravel,我的观点如下 @if($secure==true) @否则 @恩迪夫 在我的路线上,我有 路由::get('/',函数(){ 返回视图('index',['secure'=>request()->secure()]); }); 这在本地是可行的,但当部署到安全站点(使用https)时,我会收到一个错误 VM204:31 Mixed Content: The page at 'https://my-site/' was loaded over HTTPS, but requested an

我的观点如下

@if($secure==true)
@否则
@恩迪夫
在我的路线上,我有

路由::get('/',函数(){ 返回视图('index',['secure'=>request()->secure()]); }); 这在本地是可行的,但当部署到安全站点(使用https)时,我会收到一个错误


VM204:31 Mixed Content: The page at 'https://my-site/' was loaded over HTTPS, but requested an insecure stylesheet 'http://fonts.googleapis.com/css?family=Great+Vibes'. This request has been blocked; the content must be served over HTTPS.

为什么不起作用?

这应该可以回答您的问题。@1ns4n3我已经尝试了上面的
url('/fonts.googleapis.com/css?family=Great+Vibes')
。这将生成
http://localhost:8000/fonts.googleapis.com/css?family=Great+Vibes
您应该能够完全省略该方案,因此
//fonts.googleapis.com/css?family=Great+Vibes
应该同时提供这两种服务