在Laravel中强制将http重定向到https
laravel使用中间件强制重定向HTTPS
示例代码:
修改app/Providers/AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Pagination\Paginator;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
\URL::forceScheme('https');
Paginator::useBootstrap();
}
}
这样就可以了
相关文章