Laravel:HTTPS形式为:: open() [英] Laravel: HTTPS in Form::open()

查看:76
本文介绍了Laravel:HTTPS形式为:: open()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在登录名中使用SSL表示我的网站(Cloudflare HTTPS),因为我使用``,Laravel不会将我的网站链接转换为SSL版本,并且显示http版本.如何强制Laravel为我使用https?

I'm using SSL for my website (Cloudflare HTTPS) in my login for weh I use ``, Laravel won't convert my website link to SSL version and it shows http version. How can I force Laravel to use https for me?

例如:

<?=Form::open(array('id' =>'submit'))?>

   . . .

<?=Form::close()?>

结果将是:

<form method="POST" action="http://example.com" accept-charset="UTF-8" id="submit">

</form>

我希望action成为HTTPS链接.

推荐答案

如果要使用https,则需要手动提供将被设置为操作的路径.

If you want to use https you need to manually give path which will be set to action.

您需要通过以下方式使用URL::to:

You need to use URL::to this way:

<?=Form::open(array('url' => URL::to('/', array(), true), 'id' =>'submit' ))?>

提交到/网址(将等同于example.com)并作为第三个参数true传递,以确保其安全性

to make submit to / url (which will be equivalent to example.com) and pass as 3rd parameter true to make it secure

这篇关于Laravel:HTTPS形式为:: open()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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