Laravel:表单中的 HTTPS::open()
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26427443/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel: HTTPS in Form::open()
提问by Sky
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 httpversion. How can I force Laravel to use httpsfor me?
我在登录时为我的网站 (Cloudflare HTTPS) 使用 SSL,因为我使用 ``,Laravel 不会将我的网站链接转换为 SSL 版本,它会显示http版本。如何强制 Laravelhttps为我使用?
For example:
例如:
<?=Form::open(array('id' =>'submit'))?>
. . .
<?=Form::close()?>
And the result will be:
结果将是:
<form method="POST" action="http://example.com" accept-charset="UTF-8" id="submit">
</form>
I want actionto be a HTTPSlink.
我想action成为一个HTTPS链接。
回答by Marcin Nabia?ek
If you want to use httpsyou need to manually give path which will be set to action.
如果要使用https,则需要手动给出将设置为操作的路径。
You need to use URL::tothis way:
您需要使用URL::to这种方式:
<?=Form::open(array('url' => URL::to('/', array(), true), 'id' =>'submit' ))?>
to make submit to /url (which will be equivalent to example.com) and pass as 3rd parameter trueto make it secure
提交到/url(相当于example.com)并作为第三个参数传递true以使其安全

