Laravel 强制使用 Https

转载 Laravel
阅读数: 3507 2018年08月21日

laravel 强制使用 https 的方式有两种!

(1)在你的app\Providers\AppServiceProvider.php中的boot方法中添加如下代码:

        laravel5.4及以上版本:\URL::forceScheme('https');

        laravel5.3及以下版本:\URL::forceSchema('https');

 (2)直接在路由中定义:

        Route::group(['https'], function () {

            // your routers

        });


参考资料
https://blog.csdn.net/haibo_j/article/details/79388175
phpriji.cn | 网站地图 | 沪ICP备17015433号-1