Edit
I can't really find a way to generate a secure URL from route name.
要获得完整的URL,我使用
echo route('my_route_name');
但是,如果我想要一个带有https的URL,该怎么办呢?
Edit
I can't really find a way to generate a secure URL from route name.
要获得完整的URL,我使用
echo route('my_route_name');
但是,如果我想要一个带有https的URL,该怎么办呢?
事实证明,laravel并不关心url是否安全,因为它是基于当前url生成的.如果您在https页面上,route()
将返回安全url.如果在http上,则为http://
url
The problem was, that Laravel didn't detect that https was enabled, which was due to faulty server configuration.
您可以通过拨打Request::isSecure();
来判断Laravel是否将当前连接视为https